diff --git a/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/ConfigLoader.java b/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/ConfigLoader.java index b01c9e0..9ba2b9a 100644 --- a/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/ConfigLoader.java +++ b/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/ConfigLoader.java @@ -52,6 +52,7 @@ public interface ConfigLoader { final boolean useSSL = node.getNode("useSSL").getBoolean(false); final boolean overrideBungeeCommands = node.getNode("override-bungee-commands").getBoolean(false); final boolean registerLegacyCommands = node.getNode("register-legacy-commands").getBoolean(false); + final boolean restoreOldKickBehavior = node.getNode("disable-kick-when-online").getBoolean(false); String redisPassword = node.getNode("redis-password").getString(""); String proxyId = node.getNode("proxy-id").getString("test-1"); final int maxConnections = node.getNode("max-redis-connections").getInt(10); @@ -81,7 +82,7 @@ public interface ConfigLoader { } else { plugin.logInfo("Loaded proxy id " + proxyId); } - RedisBungeeConfiguration configuration = new RedisBungeeConfiguration(proxyId, exemptAddresses, registerLegacyCommands, overrideBungeeCommands, getMessagesFromPath(createMessagesFile(dataFolder))); + RedisBungeeConfiguration configuration = new RedisBungeeConfiguration(proxyId, exemptAddresses, registerLegacyCommands, overrideBungeeCommands, getMessagesFromPath(createMessagesFile(dataFolder)), restoreOldKickBehavior); Summoner summoner; RedisBungeeMode redisBungeeMode; if (node.getNode("cluster-mode-enabled").getBoolean(false)) { @@ -134,6 +135,7 @@ public interface ConfigLoader { ConfigurationNode node = yamlConfigurationFileLoader.load(); HashMap messages = new HashMap<>(); messages.put(RedisBungeeConfiguration.MessageType.LOGGED_IN_OTHER_LOCATION, node.getNode("logged-in-other-location").getString("§cLogged in from another location.")); + messages.put(RedisBungeeConfiguration.MessageType.ALREADY_LOGGED_IN, node.getNode("already-logged-in").getString("§cYou are already logged in!")); return ImmutableMap.copyOf(messages); } diff --git a/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/RedisBungeeConfiguration.java b/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/RedisBungeeConfiguration.java index 04807e3..2e595f4 100644 --- a/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/RedisBungeeConfiguration.java +++ b/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/RedisBungeeConfiguration.java @@ -22,19 +22,20 @@ import java.util.List; public class RedisBungeeConfiguration { public enum MessageType { - LOGGED_IN_OTHER_LOCATION + LOGGED_IN_OTHER_LOCATION, + ALREADY_LOGGED_IN } private final ImmutableMap messages; public static final int CONFIG_VERSION = 1; private final String proxyId; private final List exemptAddresses; - private final boolean registerLegacyCommands; - private final boolean overrideBungeeCommands; - public RedisBungeeConfiguration(String proxyId, List exemptAddresses, boolean registerLegacyCommands, boolean overrideBungeeCommands, ImmutableMap messages) { + private final boolean restoreOldKickBehavior; + + public RedisBungeeConfiguration(String proxyId, List exemptAddresses, boolean registerLegacyCommands, boolean overrideBungeeCommands, ImmutableMap messages, boolean restoreOldKickBehavior) { this.proxyId = proxyId; this.messages = messages; ImmutableList.Builder addressBuilder = ImmutableList.builder(); @@ -44,8 +45,8 @@ public class RedisBungeeConfiguration { this.exemptAddresses = addressBuilder.build(); this.registerLegacyCommands = registerLegacyCommands; this.overrideBungeeCommands = overrideBungeeCommands; + this.restoreOldKickBehavior = restoreOldKickBehavior; } - public String getProxyId() { return proxyId; } @@ -65,4 +66,8 @@ public class RedisBungeeConfiguration { public ImmutableMap getMessages() { return messages; } + + public boolean restoreOldKickBehavior() { + return restoreOldKickBehavior; + } } diff --git a/RedisBungee-API/src/main/resources/config.yml b/RedisBungee-API/src/main/resources/config.yml index 59acbd1..ede06e1 100644 --- a/RedisBungee-API/src/main/resources/config.yml +++ b/RedisBungee-API/src/main/resources/config.yml @@ -68,5 +68,10 @@ override-bungee-commands: false # restart scripts. exempt-ip-addresses: [] +# restore old login when online behavior before 0.9.0 update +# uncomment to enable it + +# disable-kick-when-online: true + # Config version DO NOT CHANGE!!!! config-version: 1 \ No newline at end of file diff --git a/RedisBungee-API/src/main/resources/messages.yml b/RedisBungee-API/src/main/resources/messages.yml index bcf05b4..a1b1853 100644 --- a/RedisBungee-API/src/main/resources/messages.yml +++ b/RedisBungee-API/src/main/resources/messages.yml @@ -1 +1,2 @@ -logged-in-other-location: "§cYou logged in from another location!" \ No newline at end of file +logged-in-other-location: "§cYou logged in from another location!" +already-logged-in: "§cYou are already logged in!" \ No newline at end of file diff --git a/RedisBungee-Bungee/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeBungeeListener.java b/RedisBungee-Bungee/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeBungeeListener.java index df7d486..07a44bd 100644 --- a/RedisBungee-Bungee/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeBungeeListener.java +++ b/RedisBungee-Bungee/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeBungeeListener.java @@ -58,7 +58,15 @@ public class RedisBungeeBungeeListener extends AbstractRedisBungeeListener