Added check when no safe-location could be found
This commit is contained in:
parent
c41ab95baf
commit
1eb472b576
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user