mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Unban fuzzy IPs for admins. Fixes #187
This commit is contained in:
parent
179fe9d665
commit
00ac914066
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Fri May 16 15:29:27 CEST 2014
|
||||
build.number=856
|
||||
#Fri May 16 15:39:23 CEST 2014
|
||||
build.number=857
|
||||
|
@ -108,8 +108,7 @@ public class Command_glist extends TFM_Command
|
||||
for (String ip : ips)
|
||||
{
|
||||
TFM_BanManager.getInstance().unbanIp(ip);
|
||||
String[] ipParts = ip.split("\\.");
|
||||
TFM_BanManager.getInstance().unbanIp(ipParts[0] + "." + ipParts[1] + ".*.*");
|
||||
TFM_BanManager.getInstance().unbanIp(TFM_Util.getFuzzyIp(ip));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -76,12 +76,7 @@ public class Command_gtfo extends TFM_Command
|
||||
}
|
||||
|
||||
// ban IP address:
|
||||
String ip = player.getAddress().getAddress().getHostAddress();
|
||||
String[] ipParts = ip.split("\\.");
|
||||
if (ipParts.length == 4)
|
||||
{
|
||||
ip = String.format("%s.%s.*.*", ipParts[0], ipParts[1]);
|
||||
}
|
||||
String ip = TFM_Util.getFuzzyIp(player.getAddress().getAddress().getHostAddress());
|
||||
TFM_Util.bcastMsg(String.format("Banning: %s, IP: %s.", player.getName(), ip), ChatColor.RED);
|
||||
|
||||
TFM_BanManager.getInstance().addIpBan(new TFM_Ban(ip, player.getName(), sender.getName(), null, reason));
|
||||
|
@ -714,15 +714,9 @@ public class TFM_PlayerListener implements Listener
|
||||
// Verify strict IP match
|
||||
if (TFM_AdminList.isSuperAdmin(player))
|
||||
{
|
||||
if (TFM_BanManager.getInstance().isIpBanned(ip))
|
||||
{
|
||||
TFM_BanManager.getInstance().unbanIp(ip);
|
||||
}
|
||||
|
||||
if (TFM_BanManager.getInstance().isUuidBanned(player.getUniqueId()))
|
||||
{
|
||||
TFM_BanManager.getInstance().unbanUuid(player.getUniqueId());
|
||||
}
|
||||
TFM_BanManager.getInstance().unbanIp(ip);
|
||||
TFM_BanManager.getInstance().unbanIp(TFM_Util.getFuzzyIp(ip));
|
||||
TFM_BanManager.getInstance().unbanUuid(player.getUniqueId());
|
||||
|
||||
player.setOp(true);
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class TFM_ServerInterface
|
||||
}
|
||||
|
||||
// not safe to use TFM_Util.isSuperAdmin for player logging in because player.getAddress() will return a null until after player login.
|
||||
boolean isAdmin;
|
||||
final boolean isAdmin;
|
||||
if (server.getOnlineMode())
|
||||
{
|
||||
isAdmin = TFM_AdminList.getSuperUUIDs().contains(uuid);
|
||||
|
@ -825,6 +825,17 @@ public class TFM_Util
|
||||
return match;
|
||||
}
|
||||
|
||||
public static String getFuzzyIp(String ip)
|
||||
{
|
||||
final String[] ipParts = ip.split("\\.");
|
||||
if (ipParts.length == 4)
|
||||
{
|
||||
return String.format("%s.%s.*.*", ipParts[0], ipParts[1]);
|
||||
}
|
||||
|
||||
return ip;
|
||||
}
|
||||
|
||||
public static int replaceBlocks(Location center, Material fromMaterial, Material toMaterial, int radius)
|
||||
{
|
||||
int affected = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user