Use more snapshot-less holders on Paper.

This is already past the debounce so in theory it's not getting hit *often*, but I guess if it's really slow it'll still show up.
This commit is contained in:
wizjany 2024-09-13 14:15:32 -04:00
parent 02dc89b224
commit a0e397e57f
No known key found for this signature in database
GPG Key ID: 1DB5861C03B76B5E

View File

@ -1241,9 +1241,9 @@ private static <T extends Event & Cancellable> void handleInventoryHolderUse(T o
useBlockEvent.setAllowed(true);
}
Events.fireToCancel(originalEvent, useBlockEvent);
} else if (holder instanceof DoubleChest) {
InventoryHolder left = ((DoubleChest) holder).getLeftSide();
InventoryHolder right = ((DoubleChest) holder).getRightSide();
} else if (holder instanceof DoubleChest doubleChest) {
InventoryHolder left = PaperLib.isPaper() ? doubleChest.getLeftSide(false) : doubleChest.getLeftSide();
InventoryHolder right = PaperLib.isPaper() ? doubleChest.getRightSide(false) : doubleChest.getRightSide();
if (left instanceof Chest) {
Events.fireToCancel(originalEvent, new UseBlockEvent(originalEvent, cause, ((Chest) left).getBlock()));
}