From f75e07aad018adc2eadbcf94a2827ae24579ee71 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 12 Oct 2016 18:30:51 +0200 Subject: [PATCH] Show shop item and hologram on creation --- .../shopchest/listeners/ShopInteractListener.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java index 2e99275..a0f9f6f 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java @@ -31,7 +31,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; @@ -296,8 +295,13 @@ public class ShopInteractListener implements Listener { shopUtils.addShop(shop, true); executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_CREATED)); - for (Player p : Bukkit.getOnlinePlayers()) { - Bukkit.getPluginManager().callEvent(new PlayerMoveEvent(p, p.getLocation(), p.getLocation())); + for (Player p : location.getWorld().getPlayers()) { + if (p.getLocation().distanceSquared(location) <= config.maximal_distance) { + shop.getHologram().showPlayer(p); + } + if (p.getLocation().distanceSquared(location) <= config.maximal_item_distance) { + shop.getItem().setVisible(p, true); + } } }