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 44a9063..5d4a7e8 100644 --- a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/listener/OnCustomPlayerMove.java +++ b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/listener/OnCustomPlayerMove.java @@ -6,6 +6,7 @@ import eu.ruekov.ruakij.LinkedBeaconTeleporters.customPlayerMoveEvent.CustomPlay import eu.ruekov.ruakij.LinkedBeaconTeleporters.customPlayerMoveEvent.CustomPlayerMoveEventListener; import eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.LinkedBeaconTeleporter; import eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.LinkedBeaconTeleporterBlock; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -29,10 +30,18 @@ public class OnCustomPlayerMove implements CustomPlayerMoveEventListener { Player p = e.player(); UUID uuid = p.getUniqueId(); - // If player found in ignoreList, remove - // FIXME: Will remove player from list, even though he should be ignored :/ - if(playerBeaconLocation.containsKey(uuid)) - playerBeaconLocation.remove(uuid); + // If player found in ignoreList, check if he stepped out of the Beacon-light + if(playerBeaconLocation.containsKey(uuid)) { + LinkedBeaconTeleporterBlock lbtBlock = playerBeaconLocation.get(uuid); + Location lbtBlockLoc = lbtBlock.block().getLocation(); + Location pLoc = p.getLocation(); + if(lbtBlockLoc.getBlockX() != pLoc.getBlockX() || lbtBlockLoc.getBlockZ() != pLoc.getBlockZ()){ + playerBeaconLocation.remove(uuid); + } + else + // Player still on beacon, ignore + return; + } // Check if player is on-top of a beacon Block block = Function.searchForMaterial(