diff --git a/proxy/src/main/java/com/glyart/authmevelocity/proxy/listener/PluginMessageListener.java b/proxy/src/main/java/com/glyart/authmevelocity/proxy/listener/PluginMessageListener.java index fd4662b..9a9adae 100644 --- a/proxy/src/main/java/com/glyart/authmevelocity/proxy/listener/PluginMessageListener.java +++ b/proxy/src/main/java/com/glyart/authmevelocity/proxy/listener/PluginMessageListener.java @@ -87,7 +87,7 @@ public class PluginMessageListener { private void createServerConnectionRequest(Player loggedPlayer, ServerConnection connection){ final RegisteredServer loginServer = loggedPlayer.getCurrentServer().orElse(connection).getServer(); proxy.getEventManager().fireAndForget(new ProxyLoginEvent(loggedPlayer)); - if(config.getToServerOptions().sendToServer()){ + if (config.getToServerOptions().sendToServer()) { final List serverList = config.getToServerOptions().getTeleportServers(); final String randomServer = serverList.get(rm.nextInt(serverList.size())); proxy.getServer(randomServer).ifPresentOrElse(serverToSend -> diff --git a/spigot/src/main/java/com/glyart/authmevelocity/spigot/listeners/AuthMeListener.java b/spigot/src/main/java/com/glyart/authmevelocity/spigot/listeners/AuthMeListener.java index 96cfa31..da9f5df 100644 --- a/spigot/src/main/java/com/glyart/authmevelocity/spigot/listeners/AuthMeListener.java +++ b/spigot/src/main/java/com/glyart/authmevelocity/spigot/listeners/AuthMeListener.java @@ -25,8 +25,8 @@ public class AuthMeListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST) public void onLogin(LoginEvent event) { final Player player = event.getPlayer(); - PreSendLoginEvent preSendLoginEvent = new PreSendLoginEvent(player); - if(preSendLoginEvent.callEvent()){ + + if (new PreSendLoginEvent(player).callEvent()) { plugin.sendMessageToProxy(player, MessageType.LOGIN, player.getName()); } } diff --git a/spigot/src/main/java/com/glyart/authmevelocity/spigot/listeners/MessageListener.java b/spigot/src/main/java/com/glyart/authmevelocity/spigot/listeners/MessageListener.java index ce09d68..c2629ff 100644 --- a/spigot/src/main/java/com/glyart/authmevelocity/spigot/listeners/MessageListener.java +++ b/spigot/src/main/java/com/glyart/authmevelocity/spigot/listeners/MessageListener.java @@ -13,14 +13,16 @@ public class MessageListener implements PluginMessageListener { @Override public void onPluginMessageReceived(@NotNull String identifier, @NotNull Player player, @NotNull byte[] bytes) { - if(identifier.equals("authmevelocity")){ - ByteArrayDataInput input = ByteStreams.newDataInput(bytes); - String subchannel = input.readUTF(); - if("main".equals(subchannel)){ - String msg = input.readUTF(); - if("LOGIN".equals(msg)){ - AuthMeApi.getInstance().forceLogin(player); - } + if (!identifier.equals("authmevelocity")) { + return; + } + + ByteArrayDataInput input = ByteStreams.newDataInput(bytes); + String subchannel = input.readUTF(); + if ("main".equals(subchannel)) { + String msg = input.readUTF(); + if ("LOGIN".equals(msg)) { + AuthMeApi.getInstance().forceLogin(player); } } }