diff --git a/gal-api/src/main/java/net/limework/gal/utils/config/Configuration.java b/gal-api/src/main/java/net/limework/gal/utils/config/Configuration.java index 16b6a88..37cce8c 100644 --- a/gal-api/src/main/java/net/limework/gal/utils/config/Configuration.java +++ b/gal-api/src/main/java/net/limework/gal/utils/config/Configuration.java @@ -5,13 +5,15 @@ public interface Configuration { char getCrackedChar(); String getCrackedCharString(); + char getBedrockChar(); + boolean doReplaceSpacesWithUnderscore(); boolean useTheContainMethod(); AntiBot getAntiBot(); - String getOflineModeDomain(); + String getOnlineModeDomain(); diff --git a/gal-api/src/main/resources/config.json b/gal-api/src/main/resources/config.json index 3e04c9b..c143ab5 100644 --- a/gal-api/src/main/resources/config.json +++ b/gal-api/src/main/resources/config.json @@ -1,10 +1,11 @@ { "default-cracked-char": "-", + "bedrock-char": "*", "replace-spaces-with-underscore": true, "use-the-contain-method": false, "simple-anti-bot": { "max-connections": 590, "reset": 10 }, - "offline-mode-domain": "cracked.glomc.net" + "online-mode-domain": "p.limework.net" } \ No newline at end of file diff --git a/gal-velocity/pom.xml b/gal-velocity/pom.xml index 4fe2b76..3a97f44 100644 --- a/gal-velocity/pom.xml +++ b/gal-velocity/pom.xml @@ -44,7 +44,7 @@ com.velocitypowered velocity-api - 3.1.0 + 3.2.0-SNAPSHOT provided diff --git a/gal-velocity/src/main/java/net/limework/gal/ConfigLoader.java b/gal-velocity/src/main/java/net/limework/gal/ConfigLoader.java index f1eb305..346c46e 100644 --- a/gal-velocity/src/main/java/net/limework/gal/ConfigLoader.java +++ b/gal-velocity/src/main/java/net/limework/gal/ConfigLoader.java @@ -13,19 +13,21 @@ import java.util.concurrent.TimeUnit; public class ConfigLoader implements Configuration { private final char crackedChar; + private final char bedrockChar; private final boolean replaceSpacesWithUnderscore; private final boolean useTheContainMethod; private final AntiBot antiBot; - private final String offlineModeDomain; + private final String onlineModeDomain; public ConfigLoader(File file) throws FileNotFoundException { JsonObject jsonObject = JsonParser.parseReader(new FileReader(file)).getAsJsonObject(); this.crackedChar = (jsonObject.get("default-cracked-char").getAsString().charAt(0)); + this.bedrockChar = (jsonObject.get("bedrock-char").getAsString().charAt(0)); this.replaceSpacesWithUnderscore = jsonObject.get("replace-spaces-with-underscore").getAsBoolean(); 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.offlineModeDomain = jsonObject.get("offline-mode-domain").getAsString(); + this.onlineModeDomain = jsonObject.get("online-mode-domain").getAsString(); } @Override @@ -38,6 +40,11 @@ public class ConfigLoader implements Configuration { return String.valueOf(this.crackedChar); } + @Override + public char getBedrockChar() { + return this.bedrockChar; + } + @Override public boolean doReplaceSpacesWithUnderscore() { return this.replaceSpacesWithUnderscore; @@ -54,7 +61,8 @@ public class ConfigLoader implements Configuration { } @Override - public String getOflineModeDomain() { - return this.offlineModeDomain; + public String getOnlineModeDomain() { + return this.onlineModeDomain; } + } diff --git a/gal-velocity/src/main/java/net/limework/gal/VelocityGalPlugin.java b/gal-velocity/src/main/java/net/limework/gal/VelocityGalPlugin.java index aeee27c..212cd68 100644 --- a/gal-velocity/src/main/java/net/limework/gal/VelocityGalPlugin.java +++ b/gal-velocity/src/main/java/net/limework/gal/VelocityGalPlugin.java @@ -68,15 +68,19 @@ public class VelocityGalPlugin { @Subscribe(order = PostOrder.FIRST) public void onPreLoginEvent(PreLoginEvent event) { - if (event.getConnection().getVirtualHost().get().getHostName().equalsIgnoreCase(this.config.getOflineModeDomain())) { - event.setResult(PreLoginEvent.PreLoginComponentResult.forceOfflineMode()); - } else { + if (event.getConnection().getVirtualHost().get().getHostName().equalsIgnoreCase(this.config.getOnlineModeDomain())) { event.setResult(PreLoginEvent.PreLoginComponentResult.forceOnlineMode()); + } else { + event.setResult(PreLoginEvent.PreLoginComponentResult.forceOfflineMode()); } } - @Subscribe + + @Subscribe(order = PostOrder.LAST) public void onGameProfileRequestEvent(GameProfileRequestEvent event) { + if (event.getGameProfile().getName().charAt(0) == config.getBedrockChar()) { + return; + } if (!event.isOnlineMode()) { logger.info("handling " + event.getUsername()); String username = getCorrectCrackedUsername(event.getUsername(), config);