diff --git a/Main Plugin/pom.xml b/Main Plugin/pom.xml index ffdf6d2..1313a14 100644 --- a/Main Plugin/pom.xml +++ b/Main Plugin/pom.xml @@ -11,7 +11,7 @@ PlayerBalancer Plugin playerbalancer-plugin - 2.1.4 + 2.1.4.1 PlayerBalancer diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/connection/ConnectionIntent.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/connection/ConnectionIntent.java index 2f70a51..ddadf52 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/connection/ConnectionIntent.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/connection/ConnectionIntent.java @@ -32,14 +32,6 @@ public abstract class ConnectionIntent { throw new IllegalStateException("The servers list parameter is the same reference, this cannot happen"); } - Server current = player.getServer(); - if (current != null) { - if (section.getServers().contains(current.getInfo())) { - MessageUtils.send(player, plugin.getSettings().getMessagesProps().getSameSectionMessage()); - return; - } - } - if (section.getImplicitProvider() != ProviderType.NONE) { ServerInfo target = this.fetchServer(player, section, provider, servers); if (target != null) { @@ -101,6 +93,16 @@ public abstract class ConnectionIntent { //TODO Create this as a type public static void simple(PlayerBalancer plugin, ProxiedPlayer player, ServerSection section) { + //TODO Make this apply to all situations except kicks + //TODO (It already works like that, but I want a better way) + Server current = player.getServer(); + if (current != null) { + if (section.getServers().contains(current.getInfo())) { + MessageUtils.send(player, plugin.getSettings().getMessagesProps().getSameSectionMessage()); + return; + } + } + new ConnectionIntent(plugin, player, section) { @Override public void connect(ServerInfo server, Callback callback) { diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/ServerKickListener.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/ServerKickListener.java index 18ec00c..ad646ca 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/ServerKickListener.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/ServerKickListener.java @@ -51,10 +51,10 @@ public class ServerKickListener implements Listener { } if (props.isDebug()) { - plugin.getLogger().info(String.format("The player %s got kicked from %s, reason: %s. Matched reasons: %s", + plugin.getLogger().info(String.format("The player %s got kicked from %s, reason: \"%s\". Matched reasons: %s", player.getName(), from.getName(), - TextComponent.toPlainText(event.getKickReasonComponent()), + reason, matches )); } @@ -78,7 +78,7 @@ public class ServerKickListener implements Listener { event.setCancelled(true); event.setCancelServer(server); MessageUtils.send(player, messages.getKickMessage(), (str) -> str - .replace("{reason}", event.getKickReason()) + .replace("{reason}", reason) .replace("{from}", from.getName()) .replace("{to}", server.getName())); plugin.getProxy().getScheduler().schedule(plugin, () -> { diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/utils/MessageUtils.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/utils/MessageUtils.java index 70e0273..c4ba905 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/utils/MessageUtils.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/utils/MessageUtils.java @@ -26,5 +26,9 @@ public final class MessageUtils { return string.replace(ChatColor.COLOR_CHAR, '&'); } + public static String safePrint(String string) { + return string.replace(ChatColor.COLOR_CHAR, '\u00A7'); + } + private MessageUtils() {} } diff --git a/Main Plugin/src/main/resources/default.conf b/Main Plugin/src/main/resources/default.conf index e9cf85f..6481c88 100644 --- a/Main Plugin/src/main/resources/default.conf +++ b/Main Plugin/src/main/resources/default.conf @@ -33,7 +33,7 @@ messages { invalid-input="&cThis is an invalid input type for this command" misc-failure="&cCould not find a server to get connected to" player-bypass="&cYou have not been moved because you have the playerbalancer.bypass permission" - player-kicked="&cYou have been kicked from &a{from} &cand you are being moved to &a{to}, reason: &a{reason}" + player-kicked="&cYou have been kicked from &a{from} &cso you are being moved to &a{to}\n&cReason: &a{reason}" same-section="&cYou are already connected to a server on this section!" unavailable-server="&cThis command cannot be executed on this server" unknown-section="&aCould not find a section with that name"