glomc fork
This commit is contained in:
@@ -16,7 +16,7 @@ public class ConfigLoader implements Configuration {
|
||||
private final boolean replaceSpacesWithUnderscore;
|
||||
private final boolean useTheContainMethod;
|
||||
private final AntiBot antiBot;
|
||||
private final String onlineModeDomain;
|
||||
private final String offlineModeDomain;
|
||||
|
||||
public ConfigLoader(File file) throws FileNotFoundException {
|
||||
JsonObject jsonObject = JsonParser.parseReader(new FileReader(file)).getAsJsonObject();
|
||||
@@ -25,7 +25,7 @@ public class ConfigLoader implements Configuration {
|
||||
this.useTheContainMethod = jsonObject.get("use-the-contain-method").getAsBoolean();
|
||||
JsonObject antiBotJson = jsonObject.getAsJsonObject("simple-anti-bot");
|
||||
this.antiBot = new AntiBot(antiBotJson.get("max-connections").getAsInt(), antiBotJson.get("reset").getAsLong(), TimeUnit.MINUTES);
|
||||
this.onlineModeDomain = jsonObject.get("online-mode-domain").getAsString();
|
||||
this.offlineModeDomain = jsonObject.get("offline-mode-domain").getAsString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,7 +54,7 @@ public class ConfigLoader implements Configuration {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOnlineModeDomain() {
|
||||
return this.onlineModeDomain;
|
||||
public String getOflineModeDomain() {
|
||||
return this.offlineModeDomain;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package net.limework.gal;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.inject.Inject;
|
||||
import com.velocitypowered.api.event.PostOrder;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
@@ -23,10 +21,8 @@ import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static net.limework.gal.utils.PlayerUUIDUtils.*;
|
||||
@@ -72,10 +68,10 @@ public class VelocityGalPlugin {
|
||||
|
||||
@Subscribe(order = PostOrder.FIRST)
|
||||
public void onPreLoginEvent(PreLoginEvent event) {
|
||||
if (event.getConnection().getVirtualHost().get().getHostName().equalsIgnoreCase(this.config.getOnlineModeDomain())) {
|
||||
event.setResult(PreLoginEvent.PreLoginComponentResult.forceOnlineMode());
|
||||
} else {
|
||||
if (event.getConnection().getVirtualHost().get().getHostName().equalsIgnoreCase(this.config.getOflineModeDomain())) {
|
||||
event.setResult(PreLoginEvent.PreLoginComponentResult.forceOfflineMode());
|
||||
} else {
|
||||
event.setResult(PreLoginEvent.PreLoginComponentResult.forceOnlineMode());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user