Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1.  
  2. public boolean isInSpace(Player p) {
  3.     final Location l = p.getLocation();
  4.     boolean air1 = true;
  5.     boolean air2 = true;
  6.     final int x = l.getBlockX();
  7.     final int y = l.getBlockY();
  8.     final int z = l.getBlockZ();
  9.     final World w = l.getWorld();
  10.     int height = 40;
  11.  
  12.         if (w.getName().equalsIgnoreCase("Regalis") && this.isInSpawn(p)) {
  13.             height = 130;
  14.         }
  15.  
  16.         for (int i = 0; i < height; i++) {
  17.             final int id1 = w.getBlockTypeIdAt(x, y + i + 1, z);
  18.             final int id2 = w.getBlockTypeIdAt(x, y - i, z);
  19.             if (id1 != 0) {
  20.                 air1 = false;
  21.             }
  22.             if (id2 != 0) {
  23.                 air2 = false;
  24.             }
  25.         }
  26.     if ((!air1) && (!air2))
  27.         return false;
  28.     return true;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement