1 |
torben |
1521 |
package dk.thoerup.bukkit.hoeruputils; |
2 |
|
|
|
3 |
|
|
import org.bukkit.Location; |
4 |
|
|
import org.bukkit.World; |
5 |
|
|
import org.bukkit.block.Block; |
6 |
|
|
import org.bukkit.command.Command; |
7 |
|
|
import org.bukkit.command.CommandExecutor; |
8 |
|
|
import org.bukkit.command.CommandSender; |
9 |
|
|
import org.bukkit.entity.Player; |
10 |
|
|
|
11 |
|
|
public class SuperminerCommand implements CommandExecutor { |
12 |
|
|
|
13 |
|
|
|
14 |
|
|
@Override |
15 |
|
|
public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) { |
16 |
|
|
|
17 |
|
|
if (!(sender instanceof Player)) { |
18 |
|
|
return false; |
19 |
|
|
} |
20 |
|
|
Player p = (Player) sender; |
21 |
|
|
|
22 |
|
|
World world = p.getWorld(); |
23 |
|
|
Location l = p.getLocation(); |
24 |
|
|
|
25 |
|
|
for (int x=-5; x<=5; x++) { |
26 |
|
|
for (int y=0; y<=5; y++) { |
27 |
|
|
for (int z=-5; z<=5; z++) { |
28 |
|
|
|
29 |
|
|
Block b = world.getBlockAt( l.getBlockX()+x, l.getBlockY()+y, l.getBlockZ()+z); |
30 |
|
|
|
31 |
|
|
int id = b.getTypeId(); |
32 |
|
|
|
33 |
|
|
if (id == 1 || id == 2 || id == 3 || id == 4 || id == 8 || id == 9 || id == 10 || id == 11 || id == 13) { |
34 |
|
|
b.setTypeId( 0 ); |
35 |
|
|
} |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
|
39 |
|
|
} |
40 |
|
|
} |
41 |
|
|
|
42 |
|
|
return true; |
43 |
|
|
} |
44 |
|
|
} |