fix broken history / geyser support
This commit is contained in:
parent
a58191a961
commit
6c1699b2c5
@ -5,13 +5,15 @@ public interface Configuration {
|
|||||||
char getCrackedChar();
|
char getCrackedChar();
|
||||||
String getCrackedCharString();
|
String getCrackedCharString();
|
||||||
|
|
||||||
|
char getBedrockChar();
|
||||||
|
|
||||||
boolean doReplaceSpacesWithUnderscore();
|
boolean doReplaceSpacesWithUnderscore();
|
||||||
|
|
||||||
boolean useTheContainMethod();
|
boolean useTheContainMethod();
|
||||||
|
|
||||||
AntiBot getAntiBot();
|
AntiBot getAntiBot();
|
||||||
|
|
||||||
String getOflineModeDomain();
|
String getOnlineModeDomain();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"default-cracked-char": "-",
|
"default-cracked-char": "-",
|
||||||
|
"bedrock-char": "*",
|
||||||
"replace-spaces-with-underscore": true,
|
"replace-spaces-with-underscore": true,
|
||||||
"use-the-contain-method": false,
|
"use-the-contain-method": false,
|
||||||
"simple-anti-bot": {
|
"simple-anti-bot": {
|
||||||
"max-connections": 590,
|
"max-connections": 590,
|
||||||
"reset": 10
|
"reset": 10
|
||||||
},
|
},
|
||||||
"offline-mode-domain": "cracked.glomc.net"
|
"online-mode-domain": "p.limework.net"
|
||||||
}
|
}
|
@ -44,7 +44,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.velocitypowered</groupId>
|
<groupId>com.velocitypowered</groupId>
|
||||||
<artifactId>velocity-api</artifactId>
|
<artifactId>velocity-api</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.2.0-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -13,19 +13,21 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class ConfigLoader implements Configuration {
|
public class ConfigLoader implements Configuration {
|
||||||
|
|
||||||
private final char crackedChar;
|
private final char crackedChar;
|
||||||
|
private final char bedrockChar;
|
||||||
private final boolean replaceSpacesWithUnderscore;
|
private final boolean replaceSpacesWithUnderscore;
|
||||||
private final boolean useTheContainMethod;
|
private final boolean useTheContainMethod;
|
||||||
private final AntiBot antiBot;
|
private final AntiBot antiBot;
|
||||||
private final String offlineModeDomain;
|
private final String onlineModeDomain;
|
||||||
|
|
||||||
public ConfigLoader(File file) throws FileNotFoundException {
|
public ConfigLoader(File file) throws FileNotFoundException {
|
||||||
JsonObject jsonObject = JsonParser.parseReader(new FileReader(file)).getAsJsonObject();
|
JsonObject jsonObject = JsonParser.parseReader(new FileReader(file)).getAsJsonObject();
|
||||||
this.crackedChar = (jsonObject.get("default-cracked-char").getAsString().charAt(0));
|
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.replaceSpacesWithUnderscore = jsonObject.get("replace-spaces-with-underscore").getAsBoolean();
|
||||||
this.useTheContainMethod = jsonObject.get("use-the-contain-method").getAsBoolean();
|
this.useTheContainMethod = jsonObject.get("use-the-contain-method").getAsBoolean();
|
||||||
JsonObject antiBotJson = jsonObject.getAsJsonObject("simple-anti-bot");
|
JsonObject antiBotJson = jsonObject.getAsJsonObject("simple-anti-bot");
|
||||||
this.antiBot = new AntiBot(antiBotJson.get("max-connections").getAsInt(), antiBotJson.get("reset").getAsLong(), TimeUnit.MINUTES);
|
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
|
@Override
|
||||||
@ -38,6 +40,11 @@ public class ConfigLoader implements Configuration {
|
|||||||
return String.valueOf(this.crackedChar);
|
return String.valueOf(this.crackedChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char getBedrockChar() {
|
||||||
|
return this.bedrockChar;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doReplaceSpacesWithUnderscore() {
|
public boolean doReplaceSpacesWithUnderscore() {
|
||||||
return this.replaceSpacesWithUnderscore;
|
return this.replaceSpacesWithUnderscore;
|
||||||
@ -54,7 +61,8 @@ public class ConfigLoader implements Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOflineModeDomain() {
|
public String getOnlineModeDomain() {
|
||||||
return this.offlineModeDomain;
|
return this.onlineModeDomain;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -68,15 +68,19 @@ public class VelocityGalPlugin {
|
|||||||
|
|
||||||
@Subscribe(order = PostOrder.FIRST)
|
@Subscribe(order = PostOrder.FIRST)
|
||||||
public void onPreLoginEvent(PreLoginEvent event) {
|
public void onPreLoginEvent(PreLoginEvent event) {
|
||||||
if (event.getConnection().getVirtualHost().get().getHostName().equalsIgnoreCase(this.config.getOflineModeDomain())) {
|
if (event.getConnection().getVirtualHost().get().getHostName().equalsIgnoreCase(this.config.getOnlineModeDomain())) {
|
||||||
event.setResult(PreLoginEvent.PreLoginComponentResult.forceOfflineMode());
|
|
||||||
} else {
|
|
||||||
event.setResult(PreLoginEvent.PreLoginComponentResult.forceOnlineMode());
|
event.setResult(PreLoginEvent.PreLoginComponentResult.forceOnlineMode());
|
||||||
|
} else {
|
||||||
|
event.setResult(PreLoginEvent.PreLoginComponentResult.forceOfflineMode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
|
@Subscribe(order = PostOrder.LAST)
|
||||||
public void onGameProfileRequestEvent(GameProfileRequestEvent event) {
|
public void onGameProfileRequestEvent(GameProfileRequestEvent event) {
|
||||||
|
if (event.getGameProfile().getName().charAt(0) == config.getBedrockChar()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!event.isOnlineMode()) {
|
if (!event.isOnlineMode()) {
|
||||||
logger.info("handling " + event.getUsername());
|
logger.info("handling " + event.getUsername());
|
||||||
String username = getCorrectCrackedUsername(event.getUsername(), config);
|
String username = getCorrectCrackedUsername(event.getUsername(), config);
|
||||||
|
Loading…
Reference in New Issue
Block a user