mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2025-02-12 05:55:48 +00:00
Added ipbanlist
This commit is contained in:
parent
112382893d
commit
ce90ea2502
3 changed files with 51 additions and 0 deletions
|
@ -293,6 +293,53 @@ public class TFM_Cmds_General implements CommandExecutor
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GRAY + banned_players.toString());
|
sender.sendMessage(ChatColor.GRAY + banned_players.toString());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (cmd.getName().equalsIgnoreCase("ipbanlist"))
|
||||||
|
{
|
||||||
|
if (args.length > 0)
|
||||||
|
{
|
||||||
|
if (args[0].equalsIgnoreCase("purge"))
|
||||||
|
{
|
||||||
|
if (senderIsConsole || plugin.isUserSuperadmin(sender))
|
||||||
|
{
|
||||||
|
for (String ip : Bukkit.getIPBans())
|
||||||
|
{
|
||||||
|
Bukkit.unbanIP(ip);
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(ChatColor.GRAY + "IP Ban list has been purged.");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.YELLOW + "You do not have permission to purge the IP ban list, you may only view it.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> ip_bans = Arrays.asList(Bukkit.getIPBans().toArray(new String[0]));
|
||||||
|
Collections.sort(ip_bans);
|
||||||
|
|
||||||
|
StringBuilder banned_ips = new StringBuilder();
|
||||||
|
banned_ips.append("Banned IPs: ");
|
||||||
|
boolean first = true;
|
||||||
|
for (String ip : ip_bans)
|
||||||
|
{
|
||||||
|
if (!first)
|
||||||
|
{
|
||||||
|
banned_ips.append(", ");
|
||||||
|
}
|
||||||
|
if (ip.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"))
|
||||||
|
{
|
||||||
|
first = false;
|
||||||
|
banned_ips.append(ip.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(ChatColor.GRAY + banned_ips.toString());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,6 +300,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||||
this.getCommand("skylands").setExecutor(GeneralCommands);
|
this.getCommand("skylands").setExecutor(GeneralCommands);
|
||||||
this.getCommand("nether").setExecutor(GeneralCommands);
|
this.getCommand("nether").setExecutor(GeneralCommands);
|
||||||
this.getCommand("banlist").setExecutor(GeneralCommands);
|
this.getCommand("banlist").setExecutor(GeneralCommands);
|
||||||
|
this.getCommand("ipbanlist").setExecutor(GeneralCommands);
|
||||||
|
|
||||||
this.getCommand("fr").setExecutor(AdminCommands);
|
this.getCommand("fr").setExecutor(AdminCommands);
|
||||||
this.getCommand("gtfo").setExecutor(AdminCommands);
|
this.getCommand("gtfo").setExecutor(AdminCommands);
|
||||||
|
|
|
@ -46,6 +46,9 @@ commands:
|
||||||
gtfo:
|
gtfo:
|
||||||
description: Superadmin command - Makes someone GTFO (deop and ip ban by username).
|
description: Superadmin command - Makes someone GTFO (deop and ip ban by username).
|
||||||
usage: /<command> <partialname>
|
usage: /<command> <partialname>
|
||||||
|
ipbanlist:
|
||||||
|
description: Shows all banned IPs. Superadmins may optionally use 'purge' to clear the list.
|
||||||
|
usage: /<command> [purge]
|
||||||
lavadmg:
|
lavadmg:
|
||||||
description: Superadmin command - Enable/disable lava damage.
|
description: Superadmin command - Enable/disable lava damage.
|
||||||
usage: /<command> <on|off>
|
usage: /<command> <on|off>
|
||||||
|
|
Loading…
Reference in a new issue