TFM-4.3-Reloaded/src/me/StevenLawson/TotalFreedomMod/Commands/Command_nonuke.java

63 lines
2 KiB
Java
Raw Normal View History

2011-10-19 00:37:00 +00:00
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Command_nonuke extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
2011-11-28 22:44:51 +00:00
if (!senderIsConsole || sender.getName().equalsIgnoreCase("remotebukkit"))
2011-10-19 00:37:00 +00:00
{
2011-11-28 22:44:51 +00:00
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
return true;
}
2011-10-19 00:37:00 +00:00
2011-11-28 22:44:51 +00:00
if (args.length < 1)
{
return false;
}
if (args.length >= 2)
{
try
2011-10-19 00:37:00 +00:00
{
2011-11-28 22:44:51 +00:00
TotalFreedomMod.nukeMonitorRange = Math.max(1.0, Math.min(500.0, Double.parseDouble(args[1])));
2011-10-19 00:37:00 +00:00
}
2011-11-28 22:44:51 +00:00
catch (NumberFormatException nfex)
2011-10-19 00:37:00 +00:00
{
}
2011-11-28 22:44:51 +00:00
}
2011-10-19 00:37:00 +00:00
2011-11-28 22:44:51 +00:00
if (args.length >= 3)
{
try
2011-10-19 00:37:00 +00:00
{
2011-11-28 22:44:51 +00:00
TotalFreedomMod.nukeMonitorCountBreak = Math.max(1, Math.min(500, Integer.parseInt(args[2])));
2011-10-19 00:37:00 +00:00
}
2011-11-28 22:44:51 +00:00
catch (NumberFormatException nfex)
2011-10-19 00:37:00 +00:00
{
}
}
2011-11-28 22:44:51 +00:00
if (args[0].equalsIgnoreCase("on"))
{
TotalFreedomMod.nukeMonitor = true;
sender.sendMessage(ChatColor.GRAY + "Nuke monitor is enabled.");
sender.sendMessage(ChatColor.GRAY + "Anti-freecam range is set to " + TotalFreedomMod.nukeMonitorRange + " blocks.");
sender.sendMessage(ChatColor.GRAY + "Block throttle rate is set to " + TotalFreedomMod.nukeMonitorCountBreak + " blocks destroyed per 5 seconds.");
}
2011-10-19 00:37:00 +00:00
else
{
2011-11-28 22:44:51 +00:00
TotalFreedomMod.nukeMonitor = false;
sender.sendMessage("Nuke monitor is disabled.");
2011-10-19 00:37:00 +00:00
}
2011-11-28 22:44:51 +00:00
2011-10-19 00:37:00 +00:00
return true;
}
}