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

73 lines
2 KiB
Java
Raw Normal View History

2012-09-18 14:40:48 +00:00
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Command_permban extends TFM_Command
{
@Override
2012-09-18 14:40:48 +00:00
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!sender.isOp())
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args.length != 1)
{
return false;
}
if (args[0].equalsIgnoreCase("list"))
{
if (TotalFreedomMod.permbanned_players.size() > 0)
2012-09-18 14:40:48 +00:00
{
TFM_Util.playerMsg(sender, "No permanently banned player names.");
2012-09-18 14:40:48 +00:00
}
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);
}
2012-09-18 14:40:48 +00:00
}
if (TotalFreedomMod.permbanned_ips.size() > 0)
2012-09-18 14:40:48 +00:00
{
TFM_Util.playerMsg(sender, "No permanently banned IPs.");
2012-09-18 14:40:48 +00:00
}
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);
}
2012-09-18 14:40:48 +00:00
}
return true;
}
if (!senderIsConsole)
{
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
return true;
}
if (args[0].equalsIgnoreCase("reload"))
{
plugin.loadPermbanConfig();
2012-09-18 14:40:48 +00:00
return true;
}
return false;
2012-09-18 14:40:48 +00:00
}
}