diff --git a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/listener/OnCustomPlayerMove.java b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/listener/OnCustomPlayerMove.java index d5b537c..e201a9f 100644 --- a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/listener/OnCustomPlayerMove.java +++ b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/listener/OnCustomPlayerMove.java @@ -84,9 +84,6 @@ public class OnCustomPlayerMove implements CustomPlayerMoveEventListener { else{ // TODO: Check if beacon is active - // Set player as ignored on target-LinkedBeaconTeleporter (so he wont trigger the teleport again) - playerBeaconLocation.put(uuid, lbtBlockPartner); - // Get safe-location on top of other beacon Block safeBlock = Function.searchForMaterial( lbtBlockPartner.block().getLocation().add(0, 1, 0), @@ -94,8 +91,16 @@ public class OnCustomPlayerMove implements CustomPlayerMoveEventListener { Material.AIR, Function.transparentMaterials ); + + if(safeBlock == null){ + // No safe location found + return; + } // TODO: Check if there is enough space for a player + // Set player as ignored on target-LinkedBeaconTeleporter (so he wont trigger the teleport again) + playerBeaconLocation.put(uuid, lbtBlockPartner); + // Teleport e.player().teleport( safeBlock.getLocation().add(0.5, 0, 0.5)