From 3ddaf665e28f94a835c37e414c7808aebd8777a9 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 24 Apr 2019 10:23:12 +1000 Subject: [PATCH] SPIGOT-4722: Cannot get title of player's inventory --- nms-patches/Container.patch | 4 ++-- nms-patches/ContainerPlayer.patch | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/nms-patches/Container.patch b/nms-patches/Container.patch index 44939b13d0..1870b5ab67 100644 --- a/nms-patches/Container.patch +++ b/nms-patches/Container.patch @@ -34,11 +34,11 @@ + ((CraftInventory) destination.getBottomInventory()).getInventory().onOpen(player); + } + private IChatBaseComponent title; -+ public IChatBaseComponent getTitle() { ++ public final IChatBaseComponent getTitle() { + Preconditions.checkState(this.title != null, "Title not set"); + return this.title; + } -+ public void setTitle(IChatBaseComponent title) { ++ public final void setTitle(IChatBaseComponent title) { + Preconditions.checkState(this.title == null, "Title already set"); + this.title = title; + } diff --git a/nms-patches/ContainerPlayer.patch b/nms-patches/ContainerPlayer.patch index fb339b0d16..2562fa658e 100644 --- a/nms-patches/ContainerPlayer.patch +++ b/nms-patches/ContainerPlayer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ContainerPlayer.java +++ b/net/minecraft/server/ContainerPlayer.java -@@ -1,18 +1,35 @@ +@@ -1,18 +1,36 @@ package net.minecraft.server; +// CraftBukkit start @@ -34,11 +34,12 @@ + this.craftInventory = new InventoryCrafting(this, 2, 2, playerinventory.player); // CraftBukkit - pass player + this.craftInventory.resultInventory = this.resultInventory; // CraftBukkit - let InventoryCrafting know about its result slot + this.player = playerinventory; // CraftBukkit - save player ++ setTitle(new ChatMessage("container.crafting")); // SPIGOT-4722: Allocate title for player inventory + // CraftBukkit end this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 154, 28))); int i; -@@ -79,7 +96,7 @@ +@@ -79,7 +97,7 @@ @Override public void a(IInventory iinventory) { @@ -47,7 +48,7 @@ } @Override -@@ -182,4 +199,17 @@ +@@ -182,4 +200,17 @@ public int h() { return this.craftInventory.f(); }