SPIGOT-287: Fire a cancelled inventory open event for locked chests
By: Thinkofdeath <thinkofdeath@spigotmc.org>
This commit is contained in:
@@ -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