Mineplex2018-withcommit/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/RequiredRankCommand.java

54 lines
1.4 KiB
Java

package nautilus.game.arcade.command;
import org.bukkit.entity.Player;
import nautilus.game.arcade.ArcadeManager;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
public class RequiredRankCommand extends CommandBase<ArcadeManager>
{
private ArcadeManager _manager;
public RequiredRankCommand(ArcadeManager plugin)
{
super(plugin, Rank.DEVELOPER, new Rank[]{Rank.JNR_DEV}, "Requiredrank");
_manager = plugin;
}
@Override
public void Execute(Player caller, String[] args)
{
if(!_manager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"))
{
UtilPlayer.message(caller, F.main("Command", "This is not a test server.."));
return;
}
if(args.length == 0)
{
UtilPlayer.message(caller, F.main("Command", "Invalid rank input."));
return;
}
if(args[0].equalsIgnoreCase("Reset"))
{
_manager.setRequiredRank(null);
UtilPlayer.message(caller, F.main("Command", "You reset the required rank to null."));
return;
}
try
{
Rank rank = Rank.valueOf(args[0]);
_manager.setRequiredRank(rank);
UtilPlayer.message(caller, F.main("Command", "You set the required rank to: " + rank.getColor() + rank.Name));
}
catch (IllegalArgumentException e)
{
UtilPlayer.message(caller, F.main("Command", "Invalid rank input."));
}
}
}