SPIGOT-4722: Cannot get title of player's inventory

This commit is contained in:
md_5 2019-04-24 10:23:12 +10:00
parent 6d504c2d4c
commit 3ddaf665e2
2 changed files with 6 additions and 5 deletions

View File

@ -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;
+ }

View File

@ -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();
}