Added /ro

This commit is contained in:
Jerom van der Sar 2012-11-28 17:35:31 +01:00
parent 2d9fafc05e
commit e0cf28a055
5 changed files with 92 additions and 5 deletions

View File

@ -1,5 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@ -24,6 +25,8 @@ public class Command_explosives extends TFM_Command
}
catch (NumberFormatException nfex)
{
TFM_Util.playerMsg(sender, nfex.getMessage());
return true;
}
}

View File

@ -36,11 +36,11 @@ public class Command_list extends TFM_Command
{
if(TFM_SuperadminList.isSeniorAdmin(p))
{
prefix = (ChatColor.LIGHT_PURPLE + "[SenAdmin]");
prefix = (ChatColor.LIGHT_PURPLE + "[SrA]");
}
else
{
prefix = (ChatColor.GOLD + "[SupAdmin]");
prefix = (ChatColor.GOLD + "[SA]");
}
}
else

View File

@ -0,0 +1,81 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.BOTH, block_web_console = false, ignore_permissions = false)
public class Command_ro extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if(args.length < 1 || args.length > 3) {
return false;
}
int radius = 50;
Player target_player = null;
Material target_block = Material.matchMaterial(args[0]);
if (target_block == null)
{
TFM_Util.playerMsg(sender, "Invalid block!");
return true;
}
if(args.length >= 2)
{
try
{
radius = Integer.parseInt(args[1]);
}
catch(NumberFormatException nfex)
{
TFM_Util.playerMsg(sender, nfex.getMessage());
return true;
}
if(radius > 3000)
{
TFM_Util.playerMsg(sender, "What the hell are you trying to do, you stupid idiot!", ChatColor.RED);
return true;
}
}
if(args.length == 3)
{
try
{
target_player = getPlayer(args[2]);
}
catch (CantFindPlayerException ex)
{
sender.sendMessage(ex.getMessage());
return true;
}
}
if(target_player == null)
{
for(Player p : server.getOnlinePlayers())
{
boolean is_Op = p.isOp();
p.setOp(true);
server.dispatchCommand(p, "/removenear " + target_block.getId() + " " + radius);
p.setOp(is_Op);
}
}
else
{
boolean is_Op = target_player.isOp();
target_player.setOp(true);
server.dispatchCommand(target_player, "/removenear " + target_block.getId() + " " + radius);
target_player.setOp(is_Op);
}
return true;
}
}

View File

@ -567,11 +567,11 @@ public class TFM_Util
if (admin_entry.isSeniorAdmin())
{
return "a " + ChatColor.GOLD + "Senior Admin" + ChatColor.AQUA + ".";
return "a " + ChatColor.LIGHT_PURPLE + "Senior Admin" + ChatColor.AQUA + ".";
}
else
{
return "a " + ChatColor.RED + "Super Admin" + ChatColor.AQUA + ".";
return "a " + ChatColor.GOLD + "Super Admin" + ChatColor.AQUA + ".";
}
}
}

View File

@ -162,8 +162,11 @@ commands:
description: Owner Command - Broadcasts the given message with no extra formatting.
usage: /<command> <message>
rd:
description: Remove all projectiles, dropped items, experience orbs, primed explosives, and minecarts. Minecarts are optional, based on if "carts" is included after the command.
description: Superadmin command - Remove all projectiles, dropped items, experience orbs, primed explosives, and minecarts. Minecarts are optional, based on if "carts" is included after the command.
usage: /<command> <carts>
ro:
description: Superadmin Command - Remove all blocks of a certain type in the radius of certain players.
usage: /<command> <block> [radius (default=50)] [player]
saconfig:
description: Owner command - Manage superadmins.
usage: /<command> <list | clean | <add|delete> <username>>