1 |
torben |
1501 |
package dk.thoerup.bukkit.hoeruputils; |
2 |
|
|
|
3 |
|
|
import org.bukkit.block.Block; |
4 |
|
|
import org.bukkit.Location; |
5 |
|
|
import org.bukkit.World; |
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 StonerCommand 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 |
|
|
|
26 |
|
|
for (int x=(l.getBlockX()-2); x<=(l.getBlockX()+2); x++) { |
27 |
|
|
for (int y=(l.getBlockY()-2); y<=(l.getBlockY()+2); y++) { |
28 |
|
|
for (int z=(l.getBlockZ()-2); z<=(l.getBlockZ()+2); z++) { |
29 |
|
|
Block block = world.getBlockAt(x,y,z); |
30 |
|
|
if (block.getTypeId() == 3 || block.getTypeId() == 4 || block.getTypeId() == 13) { |
31 |
|
|
block.setTypeId(1); |
32 |
|
|
} |
33 |
|
|
} |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
return true; |
39 |
|
|
} |
40 |
|
|
} |