--- miscJava/minecraft-plugins/hoeruputils/src/HoerupUtils.java 2010/11/28 18:58:26 1197 +++ miscJava/minecraft-plugins/hoeruputils/src/HoerupUtils.java 2010/11/28 20:48:20 1198 @@ -166,9 +166,43 @@ return (srv.getBlockIdAt(x,y,z) == BLOCK_AIR && srv.getBlockIdAt(x,y+1,z) == BLOCK_AIR); } + public void slopeArea(Player player, java.lang.String[] split) { + int radius = Integer.parseInt(split[1]); + + System.out.println("Player " + player.getName() + " used slopearea with radius=" + radius); + + + int playerX = roundPos( player.getX() ); + int playerY = (int) player.getY(); + int playerZ = roundPos( player.getZ() ); + + Server srv = etc.getServer(); + + for (int x=(playerX-radius); x<=(playerX+radius); x++) { + for (int z=(playerZ-radius); z<=(playerZ+radius); z++) { + + + int xdist = Math.abs(playerX-x); + int zdist = Math.abs(playerZ-z); + + int dist = Math.max(xdist,zdist); + + //for (int y=playerY; y<=playerY+radius; y++) { + for (int y=(playerY+dist); y<=128; y++) { + srv.setBlockAt(BLOCK_AIR, x, y, z); + } + + } + + } + } @Override public boolean onCommand(Player player, java.lang.String[] split) { + if (! player.canUseCommand(split[0]) ) { + return false; + } + if( split[0].equals("/setpos") && player.canUseCommand("/setpos") ) { setPos(player, split); return true; @@ -180,6 +214,11 @@ levelArea(player, split); } return true; + } else if (split[0].equals("/slopearea") ) { + if (validateLevelOrFill(player,split)) { + slopeArea(player,split); + } + return true; } else if (split[0].equals("/fillarea") && player.canUseCommand("/fillarea")) { if (validateLevelOrFill(player,split)) { fillArea(player, split);