mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-26 01:32:02 -07:00
Fix InventoryOpenEvent cancellation
This commit is contained in:
@@ -374,7 +374,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -321,15 +514,61 @@
|
||||
@@ -321,17 +514,62 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,6 +397,8 @@
|
||||
+ cancelledBlock = !(itileinventory instanceof MenuProvider);
|
||||
+ }
|
||||
|
||||
- if (itileinventory != null) {
|
||||
- player.openMenu(itileinventory);
|
||||
+ if (player.getCooldowns().isOnCooldown(stack)) {
|
||||
+ cancelledItem = true; // Paper - correctly handle items on cooldown
|
||||
+ }
|
||||
@@ -433,10 +435,11 @@
|
||||
+ } else if (this.gameModeForPlayer == GameType.SPECTATOR) {
|
||||
+ MenuProvider itileinventory = iblockdata.getMenuProvider(world, blockposition);
|
||||
+
|
||||
if (itileinventory != null) {
|
||||
player.openMenu(itileinventory);
|
||||
+ if (itileinventory != null && player.openMenu(itileinventory).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation
|
||||
return InteractionResult.CONSUME;
|
||||
@@ -359,7 +598,7 @@
|
||||
} else {
|
||||
return InteractionResult.PASS;
|
||||
@@ -359,7 +597,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user