From 39e3b4f83794fbde346dcdcc55242e0b67cf5c43 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 6 Jan 2017 13:21:06 +0100 Subject: [PATCH] Fixed error when clicking an entity that is not an ArmorStand (only occurred with WorldGuard) --- .../shopchest/listeners/WorldGuardListener.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/listeners/WorldGuardListener.java b/src/main/java/de/epiceric/shopchest/listeners/WorldGuardListener.java index 46da2f6..7e62663 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/WorldGuardListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/WorldGuardListener.java @@ -84,11 +84,12 @@ public class WorldGuardListener implements Listener { if (event.getOriginalEvent() instanceof PlayerInteractAtEntityEvent) { PlayerInteractAtEntityEvent orig = (PlayerInteractAtEntityEvent) event.getOriginalEvent(); - Entity e = orig.getRightClicked(); - if (!Hologram.isPartOfHologram((ArmorStand) e)) return; if (e.getType() == EntityType.ARMOR_STAND) { + if (!Hologram.isPartOfHologram((ArmorStand) e)) + return; + for (Shop shop : plugin.getShopUtils().getShops()) { if (shop.getHologram().contains((ArmorStand) e)) { if (isAllowed(player, shop.getLocation(), Action.RIGHT_CLICK_BLOCK)) { @@ -112,11 +113,12 @@ public class WorldGuardListener implements Listener { if (event.getOriginalEvent() instanceof EntityDamageByEntityEvent) { EntityDamageByEntityEvent orig = (EntityDamageByEntityEvent) event.getOriginalEvent(); - Entity e = orig.getEntity(); - if (!Hologram.isPartOfHologram((ArmorStand) e)) return; if (e.getType() == EntityType.ARMOR_STAND) { + if (!Hologram.isPartOfHologram((ArmorStand) e)) + return; + for (Shop shop : plugin.getShopUtils().getShops()) { if (shop.getHologram().contains((ArmorStand) e)) { if (isAllowed(player, shop.getLocation(), Action.LEFT_CLICK_BLOCK)) {