TotalFreedomMod/src/me/totalfreedom/totalfreedommod/commands/Command_fuckoff.java

56 lines
1.6 KiB
Java
Raw Normal View History

package me.totalfreedom.totalfreedommod.commands;
2011-11-28 22:44:51 +00:00
import me.totalfreedom.totalfreedommod.permission.PlayerRank;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
2011-11-28 22:44:51 +00:00
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = PlayerRank.SENIOR_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "You'll never even see it coming.", usage = "/<command>")
public class Command_fuckoff extends FreedomCommand
2011-11-28 22:44:51 +00:00
{
2011-11-28 22:44:51 +00:00
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{
return false;
}
boolean fuckoff_enabled = false;
double fuckoff_range = 25.0;
if (args[0].equalsIgnoreCase("on"))
{
fuckoff_enabled = true;
if (args.length >= 2)
{
try
{
fuckoff_range = Math.max(5.0, Math.min(100.0, Double.parseDouble(args[1])));
}
catch (NumberFormatException ex)
2011-11-28 22:44:51 +00:00
{
}
}
}
if (TotalFreedomMod.fuckoffEnabledFor.containsKey(sender_p))
{
TotalFreedomMod.fuckoffEnabledFor.remove(sender_p);
}
if (fuckoff_enabled)
{
TotalFreedomMod.fuckoffEnabledFor.put(sender_p, new Double(fuckoff_range));
}
playerMsg("Fuckoff " + (fuckoff_enabled ? ("enabled. Range: " + fuckoff_range + ".") : "disabled."));
2011-11-28 22:44:51 +00:00
return true;
}
}