forked from LogBlock/LogBlock
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:
@ -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 {
|
||||
|
Reference in New Issue
Block a user