Skip to content

Commit

Permalink
only handle chests or shulkerboxes, instead of any Container
Browse files Browse the repository at this point in the history
Fixes #16
  • Loading branch information
RoboMWM committed Aug 4, 2019
1 parent 65a5129 commit e7dd736
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/me/ryanhamshire/AutomaticInventory/AIEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public void onBlockDamage(BlockDamageEvent event)

Block clickedBlock = event.getBlock();
if(clickedBlock == null) return;
if (!(clickedBlock.getState() instanceof Container)) return;
if (!(clickedBlock.getState() instanceof Chest) && !(clickedBlock.getState() instanceof ShulkerBox)) return;

PlayerInteractEvent fakeEvent = AutomaticInventory.instance.new FakePlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, player.getInventory().getItemInMainHand(), clickedBlock, BlockFace.EAST);
Bukkit.getServer().getPluginManager().callEvent(fakeEvent);
Expand Down Expand Up @@ -392,7 +392,8 @@ static boolean isSortableChestInventory(Inventory inventory, String name)
if(name != null && name.contains("*")) return false;

InventoryHolder holder = inventory.getHolder();
return holder instanceof Container
return holder instanceof Chest
|| holder instanceof ShulkerBox
|| holder instanceof DoubleChest
|| holder instanceof StorageMinecart;
}
Expand Down

0 comments on commit e7dd736

Please sign in to comment.