Advertisement
Guest User

Untitled

a guest
Jul 24th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1.  
  2.     void clearPlayers(MEMine mine) {
  3.  
  4.         Location pos1 = mine.getLocation("pos1");
  5.         Location pos2 = mine.getLocation("pos2");
  6.  
  7.         World world = pos1.getWorld();
  8.  
  9.         int min_x = Math.min(pos1.getBlockX(), pos2.getBlockX());
  10.         int min_y = Math.min(pos1.getBlockY(), pos2.getBlockY());
  11.         int min_z = Math.min(pos1.getBlockZ(), pos2.getBlockZ());
  12.  
  13.         int max_x = Math.max(pos1.getBlockX(), pos2.getBlockX());
  14.         int max_y = Math.max(pos1.getBlockY(), pos2.getBlockY());
  15.         int max_z = Math.max(pos1.getBlockZ(), pos2.getBlockZ());
  16.  
  17.         Location loc;
  18.  
  19.         for (Player player : Bukkit.getOnlinePlayers()) {
  20.             loc = player.getLocation();
  21.             if (loc.getBlockX() >= min_x && loc.getBlockX() <= max_x && loc.getBlockY() >= min_y - 1
  22.                     && loc.getBlockY() <= max_y && loc.getBlockZ() >= min_z && loc.getBlockZ() <= max_z) {
  23.  
  24.                 if (mine.hasSafeLocation())
  25.                     player.teleport(mine.getSafeLocation());
  26.                 else {
  27.                     loc.setY(max_y + 1);
  28.                     player.teleport(loc);
  29.                 }
  30.                
  31.                 player.sendMessage(Messages.MINE_RESET.getResult().replace("%mine%", mine.getName()));
  32.  
  33.             }
  34.         }
  35.  
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement