Guest User

Untitled

a guest
Jul 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.84 KB | None | 0 0
  1.    public boolean onCommand(Player Player, int fromid, int toid, int radius, String[] cmd)
  2.    {
  3.        if ((cmd[0].equalsIgnoreCase("/drain")) && (Player.canUseCommand("/worldtools"))) {
  4.            int dist = 0;
  5.            if (cmd.length == 2) try { dist = Integer.parseInt(cmd[1]); } catch (Throwable localThrowable) {
  6.              } if (dist == 0) {
  7.              Player.sendMessage("§6#######Drain Help#######");
  8.              Player.sendMessage("§a/drain <radius> - Drain water/lava");
  9.              Player.sendMessage("§a/drainwater <radius> - Drain water");
  10.              Player.sendMessage("§a/drainlava <radius>  - Drain lava");
  11.              Player.sendMessage("§a/ext <radius> - Remove fire"); return true;
  12.            }
  13.            int dimension = Player.getLocation().dimension;  
  14.            int xmin = (int)Player.getX()-radius;
  15.              int xmax = (int)Player.getX()+radius;
  16.              int ymin = (int)Player.getY()-radius;
  17.              int ymax = (int)Player.getY()+radius;
  18.              int zmin = (int)Player.getZ()-radius;
  19.              int zmax = (int)Player.getZ()+radius;
  20.            
  21.              for (int x = xmin; x <= xmax; x++) {
  22.                      for (int y = ymin; y <= ymax; y++) {
  23.                              for (int z = zmin; z <= zmax; z++) {    
  24.                         if (Player.getWorld().getBlockAt(x, y, z).getType() == 8){Player.getWorld().setBlockAt(0, x, y, z);}
  25.                         if (Player.getWorld().getBlockAt(x, y, z).getType() == 9){Player.getWorld().setBlockAt(0, x, y, z);}
  26.                         if (Player.getWorld().getBlockAt(x, y, z).getType() == 10){Player.getWorld().setBlockAt(0, x, y, z);}
  27.                         if (Player.getWorld().getBlockAt(x, y, z).getType() == 11){Player.getWorld().setBlockAt(0, x, y, z);}
  28.                              }
  29.                            }
  30.                          }
  31.              return true;
  32.                        }
  33.        return false;
  34. }
Add Comment
Please, Sign In to add comment