Advertisement
CaptainLepidus

Region Checking

Nov 24th, 2012
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. @EventHandler
  2.     public void PlayerMove(PlayerMoveEvent event){
  3.         Player player = event.getPlayer();
  4.         Location loc = player.getLocation();
  5.         Integer x = loc.getBlockX();
  6.         Integer z = loc.getBlockZ();
  7.         for(int i = 0; i < storage.regions.size();) {
  8.             Region reg = storage.getRegion( i );
  9.             int x1 = reg.loc1.getBlockX();
  10.             int z1 = reg.loc1.getBlockZ();
  11.             int x2 = reg.loc2.getBlockX();
  12.             int z2 = reg.loc2.getBlockZ();
  13.             if (x>x1 && x < x2 && z > z1 && z < z2){
  14.                 player.sendMessage(reg.name);
  15.             }
  16.             i ++;
  17.     }
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement