/[projects]/miscJava/minecraft-plugins/hoeruputils/src/HoerupUtils.java
ViewVC logotype

Diff of /miscJava/minecraft-plugins/hoeruputils/src/HoerupUtils.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1197 by torben, Sun Nov 28 18:58:26 2010 UTC revision 1198 by torben, Sun Nov 28 20:48:20 2010 UTC
# Line 166  public class HoerupUtils extends Plugin Line 166  public class HoerupUtils extends Plugin
166                          return  (srv.getBlockIdAt(x,y,z) == BLOCK_AIR && srv.getBlockIdAt(x,y+1,z) == BLOCK_AIR);                          return  (srv.getBlockIdAt(x,y,z) == BLOCK_AIR && srv.getBlockIdAt(x,y+1,z) == BLOCK_AIR);
167                  }                  }
168    
169                    public void slopeArea(Player player, java.lang.String[] split) {
170                            int radius = Integer.parseInt(split[1]);
171    
172                            System.out.println("Player " + player.getName() + " used slopearea with radius=" + radius);
173                            
174    
175                            int playerX = roundPos( player.getX() );
176                            int playerY = (int) player.getY();
177                            int playerZ = roundPos( player.getZ() );
178                            
179                            Server srv = etc.getServer();
180    
181                            for (int x=(playerX-radius); x<=(playerX+radius); x++) {
182                                    for (int z=(playerZ-radius); z<=(playerZ+radius); z++) {
183    
184    
185                                            int xdist = Math.abs(playerX-x);
186                                            int zdist = Math.abs(playerZ-z);
187    
188                                            int dist = Math.max(xdist,zdist);
189    
190                                            //for (int y=playerY; y<=playerY+radius; y++) {
191                                            for (int y=(playerY+dist); y<=128; y++) {
192                                                    srv.setBlockAt(BLOCK_AIR, x, y, z);
193                                            }
194    
195                                    }
196    
197                            }
198                    }
199    
200                  @Override                  @Override
201                  public boolean onCommand(Player player, java.lang.String[] split) {                  public boolean onCommand(Player player, java.lang.String[] split) {
202                            if (! player.canUseCommand(split[0]) ) {
203                                    return false;
204                            }
205                            
206                          if( split[0].equals("/setpos") && player.canUseCommand("/setpos") ) {                          if( split[0].equals("/setpos") && player.canUseCommand("/setpos") ) {
207                                  setPos(player, split);                                  setPos(player, split);
208                                  return true;                                  return true;
# Line 180  public class HoerupUtils extends Plugin Line 214  public class HoerupUtils extends Plugin
214                                          levelArea(player, split);                                          levelArea(player, split);
215                                  }                                  }
216                                  return true;                                  return true;
217                            } else if (split[0].equals("/slopearea") ) {
218                                    if (validateLevelOrFill(player,split)) {
219                                            slopeArea(player,split);
220                                    }
221                                    return true;
222                          } else if (split[0].equals("/fillarea") && player.canUseCommand("/fillarea")) {                          } else if (split[0].equals("/fillarea") && player.canUseCommand("/fillarea")) {
223                                  if (validateLevelOrFill(player,split)) {                                  if (validateLevelOrFill(player,split)) {
224                                          fillArea(player, split);                                          fillArea(player, split);

Legend:
Removed from v.1197  
changed lines
  Added in v.1198

  ViewVC Help
Powered by ViewVC 1.1.20