blob: 7e6e347c39e2439d0090411327c1b4b8dd952013 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n.tl;
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.entity.Player;
import org.bukkit.entity.TNTPrimed;
public class Commandnuke extends EssentialsCommand
{
public Commandnuke()
{
super("nuke");
}
@Override
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NoSuchFieldException, NotEnoughArgumentsException
{
List<Player> targets;
if (args.length > 0)
{
targets = new ArrayList<Player>();
int pos = 0;
for (String arg : args)
{
targets.add(getPlayer(server, sender, args, pos).getBase());
pos++;
}
}
else
{
targets = Arrays.asList(server.getOnlinePlayers());
}
ess.getTNTListener().enable();
for (Player player : targets)
{
if (player == null)
{
continue;
}
player.sendMessage(tl("nuke"));
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 Location tntloc = new Location(world, loc.getBlockX() + x, world.getHighestBlockYAt(loc) + 64, loc.getBlockZ() + z);
final TNTPrimed tnt = world.spawn(tntloc, TNTPrimed.class);
}
}
}
}
}
|