TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipepunishments.java
speed 293ea04c56 staff -> admins
* rename everything containing staff back to admin (as requested by ryan i've renamed commands like slconfig to saconfig but left "slconfig" as an alias)
* format almost every file correctly
* a few other improvements
2020-12-03 19:28:53 -05:00

40 lines
1.3 KiB
Java

package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
@CommandParameters(description = "Wipes all logged punishments or punishments for a specific user.", usage = "/<command> <username | -a>")
public class Command_wipepunishments extends FreedomCommand
{
@Override
public boolean run(final CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{
return false;
}
if (args[0].equalsIgnoreCase("-a"))
{
FUtil.adminAction(sender.getName(), "Wiping the punishment history", true);
msg("Wiped " + plugin.pul.clear() + " punishments.");
}
else
{
String username = args[0];
FUtil.adminAction(sender.getName(), "Wiping the punishment history for " + username, true);
msg("Wiped " + plugin.pul.clear(username) + " punishments for " + username + ".");
}
return true;
}
}