From ce323f5f506d5dd04a1e3ac0035f8280502ce3ef Mon Sep 17 00:00:00 2001 From: frymaster Date: Sat, 11 Jul 2015 17:43:30 +0100 Subject: [PATCH] Alter double chest type/location code This alters the behaviour of the ``getInventoryHolderLocation`` and ``getInventoryHolderType`` methods in a way which should have identical behaviour for double chests but which should also not raise an exception if there are triple (or larger) chests. The type will be correct; the location will at least return *something* which is the location of one of the chests involved, but it'll probably be semi-arbitrary what coordinates are returned. Fixes #563 - note issue #533 which this does **not** address --- src/main/java/de/diddiz/util/BukkitUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/diddiz/util/BukkitUtils.java b/src/main/java/de/diddiz/util/BukkitUtils.java index dbb21c7..02a00c5 100644 --- a/src/main/java/de/diddiz/util/BukkitUtils.java +++ b/src/main/java/de/diddiz/util/BukkitUtils.java @@ -204,7 +204,7 @@ public class BukkitUtils { public static int getInventoryHolderType(InventoryHolder holder) { if (holder instanceof DoubleChest) { - return ((DoubleChest) holder).getLocation().getBlock().getTypeId(); + return getInventoryHolderType(((DoubleChest) holder).getLeftSide()); } else if (holder instanceof BlockState) { return ((BlockState) holder).getTypeId(); } else { @@ -214,7 +214,7 @@ public class BukkitUtils { public static Location getInventoryHolderLocation(InventoryHolder holder) { if (holder instanceof DoubleChest) { - return ((DoubleChest) holder).getLocation(); + return getInventoryHolderLocation(((DoubleChest) holder).getLeftSide()); } else if (holder instanceof BlockState) { return ((BlockState) holder).getLocation(); } else {