From 1fbcd760981ce1e8cf3f7244bacd4f6858346d55 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 23 Nov 2016 17:23:57 +0100 Subject: [PATCH] Fixed WorldGuard support for lower versions --- .../de/epiceric/shopchest/listeners/WorldGuardListener.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/epiceric/shopchest/listeners/WorldGuardListener.java b/src/main/java/de/epiceric/shopchest/listeners/WorldGuardListener.java index 0e8fc87..6003ed2 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/WorldGuardListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/WorldGuardListener.java @@ -13,6 +13,7 @@ import de.epiceric.shopchest.utils.Permissions; import de.epiceric.shopchest.worldguard.ShopFlag; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.block.Chest; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -103,7 +104,7 @@ public class WorldGuardListener implements Listener { InventoryOpenEvent orig = (InventoryOpenEvent) event.getOriginalEvent(); if (orig.getInventory().getType() == InventoryType.CHEST) { - if (isAllowed(event, orig.getInventory().getLocation(), Action.RIGHT_CLICK_BLOCK)) { + if (isAllowed(event, ((Chest)orig.getInventory().getHolder()).getLocation(), Action.RIGHT_CLICK_BLOCK)) { event.setAllowed(true); orig.setCancelled(false); }