Merge pull request #353 from Wild1145/master

ForceIP bugfixes.
This commit is contained in:
Jerom van der Sar 2014-11-01 21:00:19 +01:00
commit cf072dc0d5
5 changed files with 18 additions and 10 deletions

View file

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Sat Nov 01 15:34:44 GMT 2014
build.number=961
#Sat Nov 01 19:54:24 GMT 2014
build.number=964

View file

@ -6,8 +6,11 @@ server:
# You should change this to your server's name
name: TotalFreedom
# The address your server is located at - Please include the port if required.
# 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%

View file

@ -30,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"),

View file

@ -35,8 +35,9 @@ import org.bukkit.util.Vector;
public class TFM_PlayerListener implements Listener
{
private static final List<String> 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<String> 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)
@ -855,12 +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()))
{
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, TFM_ConfigEntry.FORCE_IP_KICKMSG.getString().replace("%address%", TFM_ConfigEntry.SERVER_ADDRESS.getString()));
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));
}
}
}

View file

@ -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());
}