fix broken history / geyser support
This commit is contained in:
parent
a58191a961
commit
6c1699b2c5
@ -5,13 +5,15 @@ public interface Configuration {
|
||||
char getCrackedChar();
|
||||
String getCrackedCharString();
|
||||
|
||||
char getBedrockChar();
|
||||
|
||||
boolean doReplaceSpacesWithUnderscore();
|
||||
|
||||
boolean useTheContainMethod();
|
||||
|
||||
AntiBot getAntiBot();
|
||||
|
||||
String getOflineModeDomain();
|
||||
String getOnlineModeDomain();
|
||||
|
||||
|
||||
|
||||
|
@ -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"
|
||||
}
|
@ -44,7 +44,7 @@
|
||||
<dependency>
|
||||
<groupId>com.velocitypowered</groupId>
|
||||
<artifactId>velocity-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user