From 794b76321ae2ae457c63a86f76310dfee5e1e1cf Mon Sep 17 00:00:00 2001 From: JeromSar Date: Thu, 13 Nov 2014 18:37:49 +0100 Subject: [PATCH] Avoid adding blocked IPs to the superadmin list --- buildnumber.properties | 4 ++-- .../TotalFreedomMod/TFM_AdminList.java | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/buildnumber.properties b/buildnumber.properties index ff32cd2..c6f5b60 100644 --- a/buildnumber.properties +++ b/buildnumber.properties @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Sat Aug 30 16:14:15 CEST 2014 -build.number=949 +#Thu Nov 13 18:09:08 CET 2014 +build.number=951 diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_AdminList.java b/src/me/StevenLawson/TotalFreedomMod/TFM_AdminList.java index a6c9bbf..c02a161 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_AdminList.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_AdminList.java @@ -433,12 +433,12 @@ public class TFM_AdminList final Player player = (Player) sender; - if (Bukkit.getOnlineMode() && superUUIDs.contains(TFM_UuidManager.getUniqueId(player))) + if (superIps.contains(TFM_Util.getIp(player))) { return true; } - if (superIps.contains(TFM_Util.getIp(player))) + if (Bukkit.getOnlineMode() && superUUIDs.contains(TFM_UuidManager.getUniqueId(player))) { return true; } @@ -556,6 +556,7 @@ public class TFM_AdminList { final UUID uuid = TFM_UuidManager.getUniqueId(player); final String ip = TFM_Util.getIp(player); + final boolean canSuperIp = !TFM_MainConfig.getList(TFM_ConfigEntry.NOADMIN_IPS).contains(ip); if (adminList.containsKey(uuid)) { @@ -566,7 +567,7 @@ public class TFM_AdminList { superadmin.setLastLogin(new Date()); - if (ip != null && !TFM_MainConfig.getList(TFM_ConfigEntry.NOADMIN_IPS).contains(ip)) + if (ip != null && canSuperIp) { superadmin.addIp(ip); } @@ -579,11 +580,17 @@ public class TFM_AdminList if (ip == null) { - TFM_Log.severe("Cannot add superadmin: " + TFM_Util.formatPlayer(player)); + TFM_Log.severe("Could not add superadmin: " + TFM_Util.formatPlayer(player)); TFM_Log.severe("Could not retrieve IP!"); return; } + if (!canSuperIp) + { + TFM_Log.warning("Could not add superadmin: " + TFM_Util.formatPlayer(player)); + TFM_Log.warning("IP " + ip + " may not be supered."); + return; + } final TFM_Admin superadmin = new TFM_Admin( uuid,