mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-17 04:46:11 +00:00
a0058869c9
Moved resources to correct folder Fixed and improved build information, no longer tracking build.properties
64 lines
2.2 KiB
Java
64 lines
2.2 KiB
Java
package me.totalfreedom.totalfreedommod.commands;
|
|
|
|
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
|
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
@CommandPermissions(level = PlayerRank.SUPER_ADMIN, source = SourceType.BOTH)
|
|
@CommandParameters(description = "Block all commands for a specific player.", usage = "/<command> <purge | <partialname>>", aliases = "blockcommands,blockcommand")
|
|
public class Command_blockcmd extends FreedomCommand
|
|
{
|
|
|
|
@Override
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
{
|
|
if (args.length != 1)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (args[0].equalsIgnoreCase("purge"))
|
|
{
|
|
FUtil.adminAction(sender.getName(), "Unblocking commands for all players", true);
|
|
int counter = 0;
|
|
for (Player player : server.getOnlinePlayers())
|
|
{
|
|
FPlayer playerdata = plugin.pl.getPlayer(player);
|
|
if (playerdata.allCommandsBlocked())
|
|
{
|
|
counter += 1;
|
|
playerdata.setCommandsBlocked(false);
|
|
}
|
|
}
|
|
playerMsg("Unblocked commands for " + counter + " players.");
|
|
return true;
|
|
}
|
|
|
|
final Player player = getPlayer(args[0]);
|
|
|
|
if (player == null)
|
|
{
|
|
playerMsg(FreedomCommand.PLAYER_NOT_FOUND);
|
|
return true;
|
|
}
|
|
|
|
if (isAdmin(sender))
|
|
{
|
|
playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked.");
|
|
return true;
|
|
}
|
|
|
|
FPlayer playerdata = plugin.pl.getPlayer(player);
|
|
|
|
playerdata.setCommandsBlocked(!playerdata.allCommandsBlocked());
|
|
|
|
FUtil.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + player.getName(), true);
|
|
playerMsg((playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands.");
|
|
|
|
return true;
|
|
}
|
|
}
|