3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Paper/CraftBukkit-Patches/0003-Address-BUKKIT-3286-by-firing-the-inventory-close-ev.patch

43 Zeilen
1.8 KiB
Diff

From 748657f2ca08bb10cdd55a063cd78cf0ab51fc4a Mon Sep 17 00:00:00 2001
From: md_5 <md_5@bigpond.com>
Date: Sun, 23 Dec 2012 17:09:40 +1100
Subject: [PATCH] Address BUKKIT-3286 by firing the inventory close event when
a secondary container is closed due to the player entity being destroyed.
This covers all edge cases such as server stop / player kick / player quit.
---
src/main/java/net/minecraft/server/EntityHuman.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 7afa68e..c6f8ff9 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -4,10 +4,12 @@ import java.util.Iterator;
import java.util.List;
// CraftBukkit start
+import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.entity.CraftItem;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityCombustByEntityEvent;
+import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.event.player.PlayerBedLeaveEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
@@ -883,6 +885,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
super.die();
this.defaultContainer.b(this);
if (this.activeContainer != null) {
+ // CraftBukkit start
+ InventoryCloseEvent event = new InventoryCloseEvent(this.activeContainer.getBukkitView());
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ // CraftBukkit end
this.activeContainer.b(this);
}
}
--
1.8.1-rc2