mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-25 10:29:41 -05:00
SPIGOT-287: Fire a cancelled inventory open event for locked chests
This commit is contained in:
1 parent
2d5a55b369
commit
0a0d3aa5a7
2 files changed
+45
-24
No files matched your search
@@ -680,6 +680,10 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static Container callInventoryOpenEvent(EntityPlayer player, Container container) {
|
||||
return callInventoryOpenEvent(player, container, false);
|
||||
}
|
||||
|
||||
public static Container callInventoryOpenEvent(EntityPlayer player, Container container, boolean cancelled) {
|
||||
if (player.activeContainer != player.defaultContainer) { // fire INVENTORY_CLOSE if one already open
|
||||
player.playerConnection.a(new PacketPlayInCloseWindow(player.activeContainer.windowId));
|
||||
}
|
||||
@@ -689,6 +693,7 @@ public class CraftEventFactory {
|
||||
player.activeContainer.transferTo(container, craftPlayer);
|
||||
|
||||
InventoryOpenEvent event = new InventoryOpenEvent(container.getBukkitView());
|
||||
event.setCancelled(cancelled);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
|
||||
Reference in new issue
Block a user