Skip to content

Commit

Permalink
Fixes a bug that caused chests stopped working with deposit all and q…
Browse files Browse the repository at this point in the history
…uick deposit
  • Loading branch information
ChristopherHaws committed Oct 9, 2022
1 parent c05e5a4 commit 9f7b698
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ public void run() {
var state = block.getState();
if (state instanceof InventoryHolder chest) {
var chestInventory = chest.getInventory();
if (!this.respectExclusions || InventoryUtilities.isSortableChestInventory(chestInventory,
state instanceof Nameable nameable ? nameable.getCustomName() : null)) {
if (!this.respectExclusions || InventoryUtilities.isSortableChestInventory(chestInventory, state instanceof Nameable nameable ? nameable.getCustomName() : null)) {
var playerInventory = player.getInventory();

var deposits = InventoryUtilities.depositMatching(playerInventory, chestInventory, false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.chaws.automaticinventory.utilities;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Barrel;
import org.bukkit.block.Block;
Expand All @@ -26,10 +27,10 @@ public static boolean isContainer(Block block) {
/**
* Function to check if a chest would open based only on its block above
*
* @param aboveBlockID the block above the ctest
* @param aboveBlock the block above the ctest
* @return whether the chest would not open
*/
public static boolean isOpenable(Material container, Material aboveBlockID) {
public static boolean isOpenable(Material container, Material aboveBlock) {
// This functions might make it into spigot at some point:
// https://hub.spigotmc.org/jira/browse/SPIGOT-5070
if (container == Material.BARREL) {
Expand All @@ -42,6 +43,6 @@ public static boolean isOpenable(Material container, Material aboveBlockID) {
return true;
}

return aboveBlockID.isOccluding();
return !aboveBlock.isOccluding();
}
}

0 comments on commit 9f7b698

Please sign in to comment.