TFM-4.3-Reloaded/src/me/StevenLawson/TotalFreedomMod/Commands/Command_permban.java

68 lines
2.1 KiB
Java

package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SENIOR, source = SOURCE_TYPE_ALLOWED.ONLY_CONSOLE, block_web_console = true, ignore_permissions = false)
public class Command_permban extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length != 1)
{
return false;
}
if (args[0].equalsIgnoreCase("list"))
{
dumplist(sender);
}
else if (args[0].equalsIgnoreCase("reload"))
{
TFM_Util.playerMsg(sender, "Reloading permban list...", ChatColor.RED);
plugin.loadPermbanConfig();
dumplist(sender);
}
else
{
return false;
}
return true;
}
private void dumplist(CommandSender sender)
{
if (TotalFreedomMod.permbanned_players.isEmpty())
{
TFM_Util.playerMsg(sender, "No permanently banned player names.");
}
else
{
TFM_Util.playerMsg(sender, TotalFreedomMod.permbanned_players.size() + " permanently banned players:");
for (String player_name : TotalFreedomMod.permbanned_players)
{
TFM_Util.playerMsg(sender, "- " + player_name);
}
}
if (TotalFreedomMod.permbanned_ips.isEmpty())
{
TFM_Util.playerMsg(sender, "No permanently banned IPs.");
}
else
{
TFM_Util.playerMsg(sender, TotalFreedomMod.permbanned_ips.size() + " permanently banned IPs:");
for (String ip_address : TotalFreedomMod.permbanned_ips)
{
TFM_Util.playerMsg(sender, "- " + ip_address);
}
}
}
}