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
This commit is contained in:
frymaster
2015-07-11 17:43:30 +01:00
parent 5bac149692
commit ce323f5f50

View File

@ -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 {