--- miscJava/minecraft-plugins/setposplugin/src/Setpos.java 2010/10/18 11:49:01 1168 +++ miscJava/minecraft-plugins/setposplugin/src/Setpos.java 2010/10/18 21:20:41 1169 @@ -70,12 +70,59 @@ } else if ( split[0].equals("/whereis" ) ) { whereIs(player, split); return true; + } else if (split[0].equals("/levelarea") ) { + levelArea(player, split); + return true; } else { return false; } } + private void levelArea(Player player, String[] split) { + if (split.length != 2) { + player.sendMessage("Usage: /levelarea "); + return; + } + + int radius; + try { + radius = Integer.parseInt(split[1]); + } catch (Exception e) { + player.sendMessage("levelarea: radius must be an integer"); + return; + } + + if (radius > 20) { + player.sendMessage("levelarea: radius may not exceed 20"); + return; + } + + + System.out.println("Player " + player.getName() + " used levelarea with radius=" + radius); + + + int playerX = (int) player.getX(); + int playerY = (int) player.getY(); + int playerZ = (int) player.getZ(); + + Server srv = etc.getServer(); + + int count = 0; + for (int x=(playerX-radius); x<=(playerX+radius); x++) { + for (int z=(playerZ-radius); z<=(playerZ+radius); z++) { + + //for (int y=playerY; y<=playerY+radius; y++) { + for (int y=playerY; y<=128; y++) { + count++; + srv.setBlockAt(0, x, y, z); + } + + } + + } + } + double roundToPlaces(double value, int places) {