From 3be0bc1c51eecf1f479043dbd7fbe5a02129ab06 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 5 May 2019 09:46:41 +1000 Subject: [PATCH] SPIGOT-4840: CartographyInventory not returned for InventoryClickEvent.getClickedInventory on result slot --- nms-patches/ContainerCartography.patch | 2 +- .../inventory/CraftInventoryCartography.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/nms-patches/ContainerCartography.patch b/nms-patches/ContainerCartography.patch index 9fa8dd76ca..84b2dea868 100644 --- a/nms-patches/ContainerCartography.patch +++ b/nms-patches/ContainerCartography.patch @@ -22,7 +22,7 @@ + return bukkitEntity; + } + -+ CraftInventoryCartography inventory = new CraftInventoryCartography(this.inventory); ++ CraftInventoryCartography inventory = new CraftInventoryCartography(this.inventory, this.f); + bukkitEntity = new CraftInventoryView(this.player, inventory, this); + return bukkitEntity; + } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCartography.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCartography.java index 6cfa3d3e0a..892fc902bc 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCartography.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCartography.java @@ -5,7 +5,15 @@ import org.bukkit.inventory.CartographyInventory; public class CraftInventoryCartography extends CraftInventory implements CartographyInventory { - public CraftInventoryCartography(IInventory inventory) { + private final IInventory resultInventory; + + public CraftInventoryCartography(IInventory inventory, IInventory resultInventory) { super(inventory); + this.resultInventory = resultInventory; + } + + @Override + public int getSize() { + return super.getSize() + resultInventory.getSize(); } }