diff --git a/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/LangConfiguration.java b/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/LangConfiguration.java index df99059..59dd4c2 100644 --- a/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/LangConfiguration.java +++ b/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/LangConfiguration.java @@ -121,74 +121,6 @@ public class LangConfiguration { } - public static class CommandMessages implements RegistrableMessages { - - private final Locale defaultLocale; - - // Common - private final Map COMMON_PLAYER_NOT_FOUND; - private final Map COMMON_PLAYER_NOT_SPECIFIED; - private final Map COMMON_COMMAND_NOT_SPECIFIED; - - public CommandMessages(Locale defaultLocale) { - this.defaultLocale = defaultLocale; - COMMON_PLAYER_NOT_FOUND = new HashMap<>(); - COMMON_COMMAND_NOT_SPECIFIED = new HashMap<>(); - COMMON_PLAYER_NOT_SPECIFIED = new HashMap<>(); - } - - // probably split using : - @Override - public void register(String id, Locale locale, String miniMessage) { - String[] splitId = id.split(":"); - //System.out.println(Arrays.toString(splitId) + " " + locale + miniMessage); - switch (splitId[0]) { - case "commands-common" -> { - switch (splitId[1]) { - case "player-not-found" -> COMMON_PLAYER_NOT_FOUND.put(locale, MiniMessage.miniMessage().deserialize(miniMessage)); - case "player-not-specified" -> COMMON_PLAYER_NOT_SPECIFIED.put(locale, MiniMessage.miniMessage().deserialize(miniMessage)); - case "command-not-specified" -> COMMON_COMMAND_NOT_SPECIFIED.put(locale, MiniMessage.miniMessage().deserialize(miniMessage)); - } - } - case "commands" -> { - switch (splitId[1]) { - - } - } - } - } - - public Component playerNotFound(Locale locale) { - if (COMMON_PLAYER_NOT_FOUND.containsKey(locale)) return COMMON_PLAYER_NOT_FOUND.get(locale); - return COMMON_PLAYER_NOT_FOUND.get(defaultLocale); - } - public Component playerNotFound() { - return playerNotFound(this.defaultLocale); - } - public Component commandNotSpecified(Locale locale) { - if (COMMON_COMMAND_NOT_SPECIFIED.containsKey(locale)) return COMMON_COMMAND_NOT_SPECIFIED.get(locale); - return COMMON_COMMAND_NOT_SPECIFIED.get(defaultLocale); - } - public Component commandNotSpecified() { - return commandNotSpecified(this.defaultLocale); - } - public Component playerNotSpecified(Locale locale) { - if (COMMON_PLAYER_NOT_SPECIFIED.containsKey(locale)) return COMMON_PLAYER_NOT_SPECIFIED.get(locale); - return COMMON_PLAYER_NOT_SPECIFIED.get(defaultLocale); - } - public Component playerNotSpecified() { - return playerNotSpecified(this.defaultLocale); - } - - - @Override - public void test(Locale locale) { - if (!(this.COMMON_PLAYER_NOT_FOUND.containsKey(locale) && this.COMMON_PLAYER_NOT_SPECIFIED.containsKey(locale) && this.COMMON_COMMAND_NOT_SPECIFIED.containsKey(locale))) { - throwError(locale, "commands messages"); - } - } - } - private final Component redisBungeePrefix; private final Locale defaultLanguage; @@ -197,15 +129,11 @@ public class LangConfiguration { private final Messages messages; - private final CommandMessages commandMessages; - - - public LangConfiguration(Component redisBungeePrefix, Locale defaultLanguage, boolean useClientLanguage, Messages messages, CommandMessages commandMessages) { + public LangConfiguration(Component redisBungeePrefix, Locale defaultLanguage, boolean useClientLanguage, Messages messages) { this.redisBungeePrefix = redisBungeePrefix; this.defaultLanguage = defaultLanguage; this.useClientLanguage = useClientLanguage; this.messages = messages; - this.commandMessages = commandMessages; } public Component redisBungeePrefix() { @@ -224,7 +152,4 @@ public class LangConfiguration { return messages; } - public CommandMessages commandMessages() { - return commandMessages; - } } 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 31a0aee..b162c6f 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 @@ -20,23 +20,19 @@ public class RedisBungeeConfiguration { private final String proxyId; private final List exemptAddresses; - private final boolean registerCommands; - private final boolean overrideBungeeCommands; private final boolean kickWhenOnline; private final boolean handleReconnectToLastServer; private final boolean handleMotd; - public RedisBungeeConfiguration(String proxyId, List exemptAddresses, boolean registerCommands, boolean overrideBungeeCommands, boolean kickWhenOnline, boolean handleReconnectToLastServer, boolean handleMotd) { + public RedisBungeeConfiguration(String proxyId, List exemptAddresses, boolean kickWhenOnline, boolean handleReconnectToLastServer, boolean handleMotd) { this.proxyId = proxyId; ImmutableList.Builder addressBuilder = ImmutableList.builder(); for (String s : exemptAddresses) { addressBuilder.add(InetAddresses.forString(s)); } this.exemptAddresses = addressBuilder.build(); - this.registerCommands = registerCommands; - this.overrideBungeeCommands = overrideBungeeCommands; this.kickWhenOnline = kickWhenOnline; this.handleReconnectToLastServer = handleReconnectToLastServer; this.handleMotd = handleMotd; @@ -50,14 +46,6 @@ public class RedisBungeeConfiguration { return exemptAddresses; } - public boolean doRegisterCommands() { - return registerCommands; - } - - public boolean doOverrideBungeeCommands() { - return overrideBungeeCommands; - } - public boolean kickWhenOnline() { return kickWhenOnline; } diff --git a/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/ConfigLoader.java b/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/ConfigLoader.java index acdc387..cba8576 100644 --- a/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/ConfigLoader.java +++ b/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/ConfigLoader.java @@ -43,8 +43,6 @@ public interface ConfigLoader extends GenericConfigLoader { node = yamlConfigurationFileLoader.load(); } final boolean useSSL = node.getNode("useSSL").getBoolean(false); - final boolean overrideBungeeCommands = node.getNode("override-bungee-commands").getBoolean(false); - final boolean registerCommands = node.getNode("register-commands").getBoolean(false); final boolean kickWhenOnline = node.getNode("kick-when-online").getBoolean(true); String redisPassword = node.getNode("redis-password").getString(""); String redisUsername = node.getNode("redis-username").getString(""); @@ -88,7 +86,7 @@ public interface ConfigLoader extends GenericConfigLoader { plugin.logInfo("handle reconnect to last server: {}", reconnectToLastServer); plugin.logInfo("handle motd: {}", handleMotd); - RedisBungeeConfiguration configuration = new RedisBungeeConfiguration(proxyId, exemptAddresses, registerCommands, overrideBungeeCommands, kickWhenOnline, reconnectToLastServer, handleMotd); + RedisBungeeConfiguration configuration = new RedisBungeeConfiguration(proxyId, exemptAddresses, kickWhenOnline, reconnectToLastServer, handleMotd); Summoner summoner; RedisBungeeMode redisBungeeMode; if (useSSL) { diff --git a/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/LangConfigLoader.java b/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/LangConfigLoader.java index 6ede5c6..ad30c42 100644 --- a/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/LangConfigLoader.java +++ b/RedisBungee-API/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/LangConfigLoader.java @@ -44,16 +44,8 @@ public interface LangConfigLoader extends GenericConfigLoader { messages.register(key.toString(), Locale.forLanguageTag(childKey.toString()), childChildNode.getString()); })); messages.test(defaultLocale); - LangConfiguration.CommandMessages commandMessages = new LangConfiguration.CommandMessages(defaultLocale); - node.getNode("commands-common").getChildrenMap().forEach((key, childNode) -> childNode.getChildrenMap().forEach((childKey, childChildNode) -> { - commandMessages.register("commands-common:" + key.toString(), Locale.forLanguageTag(childKey.toString()), childChildNode.getString()); - })); - node.getNode("commands").getChildrenMap().forEach((key, childNode) -> childNode.getChildrenMap().forEach((childKey, childChildNode) -> childChildNode.getChildrenMap().forEach((childChildKey, childChildChildNode) -> { - commandMessages.register("commands:" + key.toString() + ":" + childKey.toString(), Locale.forLanguageTag(childChildKey.toString()), childChildChildNode.getString()); - }))); - commandMessages.test(defaultLocale); - onLangConfigLoad(new LangConfiguration(prefix, defaultLocale, useClientLocale, messages, commandMessages)); + onLangConfigLoad(new LangConfiguration(prefix, defaultLocale, useClientLocale, messages)); } diff --git a/RedisBungee-API/src/main/resources/config.yml b/RedisBungee-API/src/main/resources/config.yml index 98e96c9..7b1e204 100644 --- a/RedisBungee-API/src/main/resources/config.yml +++ b/RedisBungee-API/src/main/resources/config.yml @@ -56,23 +56,6 @@ enable-jedis-pool-compatibility: false # max connections for the compatibility pool compatibility-max-connections: 3 -# Register RedisBungee commands -# if this disabled override-bungee-commands will be also disabled automatically. -register-commands: false - -# THIS IS BUNGEECORD ONLY OPTION! -# Whether RedisBungee should install its version of regular BungeeCord commands. -# Often, the RedisBungee commands are desired, but in some cases someone may wish to -# override the commands using another plugin. -# -# If you are just denying access to the commands, RedisBungee uses the default BungeeCord -# permissions - just deny them and access will be denied. -# -# Please note that with build 787+, most commands overridden by RedisBungee were moved to -# modules, and these must be disabled or overridden yourself. -# not used on velocity -override-bungee-commands: false - # restore old login behavior before 0.9.0 update # enabled by default # when true: when player login and there is old player with same uuid it will get disconnected as result and new player will log in @@ -94,4 +77,4 @@ exempt-ip-addresses: [] reconnect-to-last-server: false # Config version DO NOT CHANGE!!!! -config-version: 2 +config-version: 3 diff --git a/RedisBungee-API/src/main/resources/lang.yml b/RedisBungee-API/src/main/resources/lang.yml index 1a7bccd..ab96cea 100644 --- a/RedisBungee-API/src/main/resources/lang.yml +++ b/RedisBungee-API/src/main/resources/lang.yml @@ -47,61 +47,5 @@ messages: # placeholder displays server name in the message. en-us: "Connecting you to ..." - -# commands common messages -commands-common: - player-not-found: - en-us: "Player not found." - player-not-specified: - en-us: "You must specify a player name." - command-not-specified: - en-us: "You must specify a command to be run." - -# commands -commands: - glist: - single-player: - en-us: "1 player is currently online." - players: - en-us: " players are currently online." - notice: - en-us: "To see all players online, use /glist showall." - find: - found: - en-us: " is on ." - last-seen: - online: - en-us: " is currently online." - last-seen: - en-us: " last seen on ." - never-seen: - en-us: " has never been online." - ip: - connected-from: - en-us: " is connected from ." - proxy: - connected-to: - en-us: " is connected to ." - send-to-all: - sent: - en-us: "Sent the command / to all proxies." - # note: server here means a proxy. - server-id: - message: - en-us: "You are on ." - # Same here too - server-ids: - message: - en-us: "All server IDs: " - plist: - notice: - en-us: "To see all players online, use /plist showall." - not-valid-proxy: - en-us: " is not valid proxy. use /serverids for valid proxies" - single-player: - en-us: "1 player is currently online on ." - players: - en-us: " players are currently online on ." - # DO NOT CHANGE!!!!! config-version: 1 \ No newline at end of file diff --git a/RedisBungee-Bungee/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java b/RedisBungee-Bungee/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java index 2fd62f7..83e58af 100644 --- a/RedisBungee-Bungee/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java +++ b/RedisBungee-Bungee/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java @@ -249,12 +249,7 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin, Con // register plugin messages IDENTIFIERS.forEach(getProxy().getChannelRegistrar()::register); - // register commands - if (configuration.doRegisterCommands()) { - - } logInfo("RedisBungee initialized successfully "); }