Avoid adding blocked IPs to the superadmin list

This commit is contained in:
JeromSar 2014-11-13 18:37:49 +01:00
parent 8b45482d0a
commit 794b76321a
2 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Sat Aug 30 16:14:15 CEST 2014 #Thu Nov 13 18:09:08 CET 2014
build.number=949 build.number=951

View File

@ -433,12 +433,12 @@ public class TFM_AdminList
final Player player = (Player) sender; final Player player = (Player) sender;
if (Bukkit.getOnlineMode() && superUUIDs.contains(TFM_UuidManager.getUniqueId(player))) if (superIps.contains(TFM_Util.getIp(player)))
{ {
return true; return true;
} }
if (superIps.contains(TFM_Util.getIp(player))) if (Bukkit.getOnlineMode() && superUUIDs.contains(TFM_UuidManager.getUniqueId(player)))
{ {
return true; return true;
} }
@ -556,6 +556,7 @@ public class TFM_AdminList
{ {
final UUID uuid = TFM_UuidManager.getUniqueId(player); final UUID uuid = TFM_UuidManager.getUniqueId(player);
final String ip = TFM_Util.getIp(player); final String ip = TFM_Util.getIp(player);
final boolean canSuperIp = !TFM_MainConfig.getList(TFM_ConfigEntry.NOADMIN_IPS).contains(ip);
if (adminList.containsKey(uuid)) if (adminList.containsKey(uuid))
{ {
@ -566,7 +567,7 @@ public class TFM_AdminList
{ {
superadmin.setLastLogin(new Date()); superadmin.setLastLogin(new Date());
if (ip != null && !TFM_MainConfig.getList(TFM_ConfigEntry.NOADMIN_IPS).contains(ip)) if (ip != null && canSuperIp)
{ {
superadmin.addIp(ip); superadmin.addIp(ip);
} }
@ -579,11 +580,17 @@ public class TFM_AdminList
if (ip == null) 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!"); TFM_Log.severe("Could not retrieve IP!");
return; 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( final TFM_Admin superadmin = new TFM_Admin(
uuid, uuid,