Fix teleporting when falling out of arena bounds
This commit is contained in:
		@@ -32,7 +32,7 @@ public class OnPlayerMoveEvent implements Listener {
 | 
			
		||||
								((arena.pos1 != null)?arena.pos1.toString():" NULL")+ " Pos2:" +
 | 
			
		||||
								((arena.pos2 != null)?arena.pos2.toString():" NULL"));
 | 
			
		||||
                        BlockHunt.plugin.getLogger().info("Player has been returned to hiderswarp due to bad arena state");
 | 
			
		||||
						event.setCancelled(true);
 | 
			
		||||
						//event.setCancelled(true);
 | 
			
		||||
						Location loc = player.getLocation();
 | 
			
		||||
						player.playEffect(loc, Effect.ENDER_SIGNAL, null);
 | 
			
		||||
						player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
 | 
			
		||||
@@ -48,32 +48,32 @@ public class OnPlayerMoveEvent implements Listener {
 | 
			
		||||
 | 
			
		||||
					Location loc = player.getLocation();
 | 
			
		||||
					if (loc.getBlockX() > maxX) {
 | 
			
		||||
						event.setCancelled(true);
 | 
			
		||||
						//event.setCancelled(true);
 | 
			
		||||
						player.playEffect(loc, Effect.ENDER_SIGNAL, null);
 | 
			
		||||
						player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
 | 
			
		||||
						player.teleport(arena.hidersWarp);
 | 
			
		||||
					} else if (loc.getBlockX() < minX) {
 | 
			
		||||
						event.setCancelled(true);
 | 
			
		||||
						//event.setCancelled(true);
 | 
			
		||||
						player.playEffect(loc, Effect.ENDER_SIGNAL, null);
 | 
			
		||||
						player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
 | 
			
		||||
						player.teleport(arena.hidersWarp);
 | 
			
		||||
					} else if (loc.getBlockZ() > maxZ) {
 | 
			
		||||
						event.setCancelled(true);
 | 
			
		||||
						//event.setCancelled(true);
 | 
			
		||||
						player.playEffect(loc, Effect.ENDER_SIGNAL, null);
 | 
			
		||||
						player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
 | 
			
		||||
						player.teleport(arena.hidersWarp);
 | 
			
		||||
					} else if (loc.getBlockZ() < minZ) {
 | 
			
		||||
						event.setCancelled(true);
 | 
			
		||||
						//event.setCancelled(true);
 | 
			
		||||
						player.playEffect(loc, Effect.ENDER_SIGNAL, null);
 | 
			
		||||
						player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
 | 
			
		||||
						player.teleport(arena.hidersWarp);
 | 
			
		||||
					} else if (loc.getBlockY() > maxY) {
 | 
			
		||||
						event.setCancelled(true);
 | 
			
		||||
						//event.setCancelled(true);
 | 
			
		||||
						player.playEffect(loc, Effect.ENDER_SIGNAL, null);
 | 
			
		||||
						player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
 | 
			
		||||
						player.teleport(arena.hidersWarp);
 | 
			
		||||
					} else if (loc.getBlockY() < minY) {
 | 
			
		||||
						event.setCancelled(true);
 | 
			
		||||
						//event.setCancelled(true);
 | 
			
		||||
						player.playEffect(loc, Effect.ENDER_SIGNAL, null);
 | 
			
		||||
						player.playSound(loc, Sound.ENTITY_GHAST_SHOOT, 1, 1);
 | 
			
		||||
						player.teleport(arena.hidersWarp);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user