Fixed holograms from being displayed too far away after teleporting

This commit is contained in:
Eric 2017-01-21 13:30:39 +01:00
parent f5abe32f6e
commit c269cea82b
2 changed files with 12 additions and 1 deletions

View File

@ -2,10 +2,13 @@ package de.epiceric.shopchest.listeners;
import de.epiceric.shopchest.ShopChest; import de.epiceric.shopchest.ShopChest;
import de.epiceric.shopchest.event.ShopUpdateEvent; import de.epiceric.shopchest.event.ShopUpdateEvent;
import de.epiceric.shopchest.shop.Shop;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class ShopUpdateListener implements Listener { public class ShopUpdateListener implements Listener {
@ -22,4 +25,12 @@ public class ShopUpdateListener implements Listener {
} }
} }
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent e) {
for (Shop shop : plugin.getShopUtils().getShops()) {
shop.getHologram().hidePlayer(e.getPlayer());
shop.getItem().setVisible(e.getPlayer(), false);
}
}
} }

View File

@ -259,7 +259,7 @@ public class ShopUtils {
} }
} }
} else { } else {
if (shop.getHologram() != null && shop.getHologram().isVisible(player)) shop.getHologram().hidePlayer(player); if (shop.getHologram() != null) shop.getHologram().hidePlayer(player);
} }
if (distSqr <= itemDistSqr) { if (distSqr <= itemDistSqr) {