diff --git a/buildnumber.properties b/buildnumber.properties index 9d42576..b227b60 100644 --- a/buildnumber.properties +++ b/buildnumber.properties @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! #Sun Nov 02 13:49:36 CET 2014 -build.number=950 +build.number=951 diff --git a/src/config.yml b/src/config.yml index a0e1ef4..771c6df 100644 --- a/src/config.yml +++ b/src/config.yml @@ -6,8 +6,11 @@ server: # You should change this to your server's name name: TotalFreedom - # The address your server is located at - address: 64.34.165.5:28965 + # The address your server is located at. Please do not include the port. + address: play.totalfreedom.me + + # Please indicate your port. This should be 25565 unless otherwise indicated by your host + port: 25565 # Shown at the server list motd: TotalFreedom &8- Minecraft %mcversion% @@ -24,6 +27,16 @@ server: # URL players should appeal for permanent bans at permban_url: http://bit.ly/TF_PermBan + +# ForceIP Configuration +forceip: + + # Please state if you wish to enable the ForceIP system. + enabled: true + + # Please enter the kick message you wish for people to see if they are not connecting on the servers hostname + kickmsg: You have been kicked from the server - Please connect using %address% + # Blocking certain events allow: diff --git a/src/me/StevenLawson/TotalFreedomMod/Config/TFM_ConfigEntry.java b/src/me/StevenLawson/TotalFreedomMod/Config/TFM_ConfigEntry.java index d8dede3..df22f16 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Config/TFM_ConfigEntry.java +++ b/src/me/StevenLawson/TotalFreedomMod/Config/TFM_ConfigEntry.java @@ -4,6 +4,9 @@ import java.util.List; public enum TFM_ConfigEntry { + FORCE_IP_ENABLED(Boolean.class, "forceip.enabled"), + FORCE_IP_KICKMSG(String.class, "forceip.kickmsg"), + // ALLOW_EXPLOSIONS(Boolean.class, "allow.explosions"), ALLOW_FIRE_PLACE(Boolean.class, "allow.fire_place"), ALLOW_FIRE_SPREAD(Boolean.class, "allow.fire_spread"), @@ -27,6 +30,7 @@ public enum TFM_ConfigEntry SERVER_COLORFUL_MOTD(Boolean.class, "server.colorful_motd"), SERVER_NAME(String.class, "server.name"), SERVER_ADDRESS(String.class, "server.address"), + SERVER_PORT(Integer.class, "server.port"), SERVER_MOTD(String.class, "server.motd"), SERVER_OWNERS(List.class, "server.owners"), SERVER_BAN_URL(String.class, "server.ban_url"), diff --git a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java index a19e702..da1b41f 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java @@ -35,8 +35,9 @@ import org.bukkit.util.Vector; public class TFM_PlayerListener implements Listener { - private static final List BLOCKED_MUTED_CMDS = Arrays.asList(StringUtils.split("say,me,msg,m,tell,r,reply,mail,email", ",")); - private static final int MSG_PER_HEARTBEAT = 10; + public static final List BLOCKED_MUTED_CMDS = Arrays.asList(StringUtils.split("say,me,msg,m,tell,r,reply,mail,email", ",")); + public static final int MSG_PER_HEARTBEAT = 10; + public static final int DEFAULT_PORT = 25565; @EventHandler(priority = EventPriority.HIGH) public void onPlayerInteract(PlayerInteractEvent event) @@ -766,6 +767,7 @@ public class TFM_PlayerListener implements Listener @EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(PlayerJoinEvent event) { + final Player player = event.getPlayer(); final String ip = TFM_Util.getIp(player); final TFM_Player playerEntry; @@ -853,6 +855,18 @@ public class TFM_PlayerListener implements Listener public void onPlayerLogin(PlayerLoginEvent event) { TFM_ServerInterface.handlePlayerLogin(event); + + // Force IP Setup + if(TFM_ConfigEntry.FORCE_IP_ENABLED.getBoolean()) + { + if(!event.getHostname().equalsIgnoreCase(TFM_ConfigEntry.SERVER_ADDRESS.getString() + ":" + TFM_ConfigEntry.SERVER_PORT.getInteger())) + { + 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)); + + } + } } // Player Tab and auto Tags diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_FrontDoor.java b/src/me/StevenLawson/TotalFreedomMod/TFM_FrontDoor.java index 1251ec4..a4738f6 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_FrontDoor.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_FrontDoor.java @@ -481,7 +481,7 @@ public class TFM_FrontDoor { tempUrl = new URL("http://frontdoor.aws.af.cm/poll" + "?version=" + TotalFreedomMod.pluginVersion + "-" + TotalFreedomMod.buildCreator - + "&address=" + TFM_ConfigEntry.SERVER_ADDRESS.getString() + + "&address=" + TFM_ConfigEntry.SERVER_ADDRESS.getString() + ":" + TFM_ConfigEntry.SERVER_PORT.getInteger() + "&name=" + TFM_ConfigEntry.SERVER_NAME.getString() + "&bukkitversion=" + Bukkit.getVersion()); }