mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-26 18:39:23 +00:00
Fix plugin compatibility
Fix checking whether inventory owner is player in calling PlayerInventoryOverflowEvent
This commit is contained in:
@@ -5,17 +5,18 @@ Subject: [PATCH] PlayerInventoryOverflowEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
||||
index 8b4f8a475faafe3b8a479160888145c4aa603a27..e97bb84d976229ba0d386efbade71be7347d0a1a 100644
|
||||
index 8b4f8a475faafe3b8a479160888145c4aa603a27..6b0067e83920d32c62416a0c3d8ef2940ca7ed2b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
||||
@@ -340,6 +340,15 @@ public class CraftInventory implements Inventory {
|
||||
@@ -340,6 +340,16 @@ public class CraftInventory implements Inventory {
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Leaf start - PlayerInventoryOverflowEvent
|
||||
+ if (org.dreeam.leaf.event.player.PlayerInventoryOverflowEvent.getHandlerList().getRegisteredListeners().length > 0 && !leftover.isEmpty() && this.getHolder() instanceof org.bukkit.craftbukkit.entity.CraftPlayer craftPlayer) {
|
||||
+ new org.dreeam.leaf.event.player.PlayerInventoryOverflowEvent(craftPlayer, leftover).callEvent();
|
||||
+ if (org.dreeam.leaf.event.player.PlayerInventoryOverflowEvent.getHandlerList().getRegisteredListeners().length > 0
|
||||
+ && !leftover.isEmpty() && this.inventory instanceof net.minecraft.world.entity.player.Inventory && this.inventory.getOwner() instanceof org.bukkit.entity.Player player) {
|
||||
+ new org.dreeam.leaf.event.player.PlayerInventoryOverflowEvent(player, leftover).callEvent();
|
||||
+
|
||||
+ leftover = new HashMap<>();
|
||||
+ }
|
||||
|
||||
Reference in New Issue
Block a user