2020-08-01 04:10:44 +00:00
|
|
|
package me.totalfreedom.totalfreedommod.command;
|
|
|
|
|
|
|
|
import me.totalfreedom.totalfreedommod.banning.Ban;
|
|
|
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
|
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2020-09-28 03:17:01 +00:00
|
|
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
2020-08-01 04:10:44 +00:00
|
|
|
@CommandParameters(description = "Unbans the specified name.", usage = "/<command> <name> [-q]")
|
|
|
|
public class Command_unbanname extends FreedomCommand
|
|
|
|
{
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
|
|
{
|
|
|
|
if (args.length == 0)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean silent = false;
|
|
|
|
|
|
|
|
String name = args[0];
|
|
|
|
|
|
|
|
Ban ban = plugin.bm.getByUsername(name);
|
|
|
|
|
|
|
|
if (ban == null)
|
|
|
|
{
|
|
|
|
msg("The name " + name + " is not banned", ChatColor.RED);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ban.hasIps())
|
|
|
|
{
|
|
|
|
msg("This ban is not a name-only ban.");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (args.length > 1 && args[1].equals("-q"))
|
|
|
|
{
|
|
|
|
silent = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
plugin.bm.removeBan(ban);
|
|
|
|
|
|
|
|
if (!silent)
|
|
|
|
{
|
2020-08-15 22:42:46 +00:00
|
|
|
FUtil.staffAction(sender.getName(), "Unbanned the name " + name, true);
|
2020-08-01 04:10:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|