mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-16 20:36:12 +00:00
6edb6be7d9
Improved admin system Improved Rank system Implemented config converter Improved command handling Updated Aero
68 lines
2.3 KiB
Java
68 lines
2.3 KiB
Java
package me.totalfreedom.totalfreedommod.command;
|
|
|
|
import me.totalfreedom.totalfreedommod.freeze.FreezeData;
|
|
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;
|
|
|
|
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
|
@CommandParameters(description = "Freeze players (toggles on and off).", usage = "/<command> [target | purge]", aliases = "fr")
|
|
public class Command_freeze extends FreedomCommand
|
|
{
|
|
|
|
@Override
|
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
{
|
|
if (args.length == 0)
|
|
{
|
|
boolean allFrozen = plugin.fm.isGlobalFreeze();
|
|
plugin.fm.setGlobalFreeze(!allFrozen);
|
|
|
|
if (!allFrozen)
|
|
{
|
|
FUtil.adminAction(sender.getName(), "Disabling global player freeze", true);
|
|
msg("Players are now free to move.");
|
|
return true;
|
|
}
|
|
|
|
FUtil.adminAction(sender.getName(), "Disabling global player freeze", true);
|
|
msg("Players are now unfrozen.");
|
|
|
|
for (Player player : server.getOnlinePlayers())
|
|
{
|
|
if (!isAdmin(player))
|
|
{
|
|
msg(player, "You have been frozen due to rulebreakers, you will be unfrozen soon.", ChatColor.RED);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
if (args[0].equals("purge"))
|
|
{
|
|
FUtil.adminAction(sender.getName(), "Unfreezing all players", false);
|
|
plugin.fm.purge();
|
|
return true;
|
|
}
|
|
|
|
final Player player = getPlayer(args[0]);
|
|
|
|
if (player == null)
|
|
{
|
|
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
|
return true;
|
|
}
|
|
|
|
final FreezeData fd = plugin.pl.getPlayer(player).getFreezeData();
|
|
fd.setFrozen(!fd.isFrozen());
|
|
|
|
msg(player.getName() + " has been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".");
|
|
msg(player, "You have been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".", ChatColor.AQUA);
|
|
|
|
return true;
|
|
}
|
|
}
|