diff options
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandnuke.java | 43 | ||||
-rw-r--r-- | Essentials/src/plugin.yml | 2 |
2 files changed, 31 insertions, 14 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java b/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java index bd736d056..9aa4f8ac0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java @@ -1,12 +1,14 @@ package com.earth2me.essentials.commands; -import net.minecraft.server.EntityTNTPrimed; -import net.minecraft.server.World; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import org.bukkit.Location; import org.bukkit.Server; +import org.bukkit.World; import org.bukkit.command.CommandSender; -import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; public class Commandnuke extends EssentialsCommand @@ -17,23 +19,38 @@ public class Commandnuke extends EssentialsCommand } @Override - protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) + protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws NoSuchFieldException, NotEnoughArgumentsException { - Location loc; - World world; - server.broadcastMessage("May death rain upon them"); + List<Player> targets; + if (args.length > 0) + { + targets = new ArrayList<Player>(); + int pos = 0; + for (String arg : args) + { + targets.add(getPlayer(server, args, pos)); + pos++; + } + } + else + { + targets = Arrays.asList(server.getOnlinePlayers()); + } ess.getTNTListener().enable(); - for (Player player : server.getOnlinePlayers()) + for (Player player : targets) { - loc = player.getLocation(); - world = ((CraftWorld)loc.getWorld()).getHandle(); + if (player == null) { + continue; + } + player.sendMessage("May death rain upon them"); + final Location loc = player.getLocation(); + final World world = loc.getWorld(); for (int x = -10; x <= 10; x += 5) { for (int z = -10; z <= 10; z += 5) { - final EntityTNTPrimed tnt = new EntityTNTPrimed(world, loc.getBlockX() + x, 120, loc.getBlockZ() + z); - world.addEntity(tnt); - world.makeSound(tnt, "random.fuse", 1.0F, 1.0F); + final Location tntloc = new Location(world, loc.getBlockX() + x, 127, loc.getBlockZ() + z); + final TNTPrimed tnt = world.spawn(tntloc, TNTPrimed.class); } } } diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 68a7b8b30..300912857 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -181,7 +181,7 @@ commands: aliases: [enick]
nuke:
description: May death rain upon them.
- usage: /<command>
+ usage: /<command> <player>
aliases: [enuke]
pay:
description: Pays another player from your balance
|