From 7fe0b562ee2fbc3902d7b84153fecd052a718c58 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 1 Nov 2014 19:55:45 +0000 Subject: [PATCH] Cleaned it up a bit as suggested by @jeromsar --- buildnumber.properties | 4 ++-- .../Listener/TFM_PlayerListener.java | 18 ++++++------------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/buildnumber.properties b/buildnumber.properties index d1aec97..80fe27d 100644 --- a/buildnumber.properties +++ b/buildnumber.properties @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Sat Nov 01 19:44:24 GMT 2014 -build.number=963 +#Sat Nov 01 19:54:24 GMT 2014 +build.number=964 diff --git a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java index 06f5219..da1b41f 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java @@ -856,21 +856,15 @@ public class TFM_PlayerListener implements Listener { TFM_ServerInterface.handlePlayerLogin(event); - // Force IP Setup + // Force IP Setup if(TFM_ConfigEntry.FORCE_IP_ENABLED.getBoolean()) { if(!event.getHostname().equalsIgnoreCase(TFM_ConfigEntry.SERVER_ADDRESS.getString() + ":" + TFM_ConfigEntry.SERVER_PORT.getInteger())) - { - if (TFM_ConfigEntry.SERVER_PORT.getInteger() != DEFAULT_PORT) - { - event.disallow(PlayerLoginEvent.Result.KICK_OTHER, TFM_ConfigEntry.FORCE_IP_KICKMSG.getString().replace("%address%", TFM_ConfigEntry.SERVER_ADDRESS.getString()) + ":" + TFM_ConfigEntry.SERVER_PORT.getInteger()); - } - else - { - event.disallow(PlayerLoginEvent.Result.KICK_OTHER, TFM_ConfigEntry.FORCE_IP_KICKMSG.getString().replace("%address%", TFM_ConfigEntry.SERVER_ADDRESS.getString())); - - } - + { + final int port = TFM_ConfigEntry.SERVER_PORT.getInteger(); + + event.disallow(PlayerLoginEvent.Result.KICK_OTHER, TFM_ConfigEntry.FORCE_IP_KICKMSG.getString().replace("%address%", TFM_ConfigEntry.SERVER_ADDRESS.getString()) + (port == DEFAULT_PORT ? "" : ":" + port)); + } } }