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