From 6223d9393f71b2eedb69ff151d384776b0663dd0 Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 19 Nov 2016 12:52:53 +0100 Subject: [PATCH] Fix hologram visibility on join --- .../shopchest/listeners/HologramUpdateListener.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/listeners/HologramUpdateListener.java b/src/main/java/de/epiceric/shopchest/listeners/HologramUpdateListener.java index 2b2eb81..8289bdc 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/HologramUpdateListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/HologramUpdateListener.java @@ -9,6 +9,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerMoveEvent; public class HologramUpdateListener implements Listener { @@ -19,9 +20,17 @@ public class HologramUpdateListener implements Listener { this.plugin = plugin; } + @EventHandler + public void onPlayerJoin(PlayerJoinEvent e) { + updateHolograms(e.getPlayer()); + } + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onPlayerMove(PlayerMoveEvent e) { - Player p = e.getPlayer(); + updateHolograms(e.getPlayer()); + } + + private void updateHolograms(Player p) { Location playerLocation = p.getLocation(); double hologramDistanceSquared = Math.pow(plugin.getShopChestConfig().maximal_distance, 2); @@ -50,8 +59,6 @@ public class HologramUpdateListener implements Listener { } } - - } }