TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_uncage.java

45 lines
1.3 KiB
Java
Raw Normal View History

2020-06-30 07:25:38 +00:00
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.player.FPlayer;
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-08-15 22:42:46 +00:00
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
2020-06-30 07:25:38 +00:00
@CommandParameters(description = "Uncage a player", usage = "/<command> <name>")
public class Command_uncage extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 0)
{
return false;
}
Player player = getPlayer(args[0]);
if (player == null)
{
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
final FPlayer fPlayer = plugin.pl.getPlayer(player);
if (fPlayer.getCageData().isCaged())
{
2020-08-15 22:42:46 +00:00
FUtil.staffAction(sender.getName(), "Uncaging " + player.getName(), true);
2020-07-22 03:54:56 +00:00
fPlayer.getCageData().setCaged(false);
2020-06-30 07:25:38 +00:00
}
else
{
msg("That player is not caged!", ChatColor.RED);
}
return true;
}
}