mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-25 01:25:03 +01:00
SPIGOT-4722: Cannot get title of player's inventory
By: md_5 <git@md-5.net>
This commit is contained in:
parent
db7e2f9830
commit
7e5fc5e1ba
2 changed files with 6 additions and 5 deletions
|
@ -34,11 +34,11 @@
|
||||||
+ ((CraftInventory) destination.getBottomInventory()).getInventory().onOpen(player);
|
+ ((CraftInventory) destination.getBottomInventory()).getInventory().onOpen(player);
|
||||||
+ }
|
+ }
|
||||||
+ private IChatBaseComponent title;
|
+ private IChatBaseComponent title;
|
||||||
+ public IChatBaseComponent getTitle() {
|
+ public final IChatBaseComponent getTitle() {
|
||||||
+ Preconditions.checkState(this.title != null, "Title not set");
|
+ Preconditions.checkState(this.title != null, "Title not set");
|
||||||
+ return this.title;
|
+ return this.title;
|
||||||
+ }
|
+ }
|
||||||
+ public void setTitle(IChatBaseComponent title) {
|
+ public final void setTitle(IChatBaseComponent title) {
|
||||||
+ Preconditions.checkState(this.title == null, "Title already set");
|
+ Preconditions.checkState(this.title == null, "Title already set");
|
||||||
+ this.title = title;
|
+ this.title = title;
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
--- a/net/minecraft/server/ContainerPlayer.java
|
--- a/net/minecraft/server/ContainerPlayer.java
|
||||||
+++ b/net/minecraft/server/ContainerPlayer.java
|
+++ b/net/minecraft/server/ContainerPlayer.java
|
||||||
@@ -1,18 +1,35 @@
|
@@ -1,18 +1,36 @@
|
||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
+// CraftBukkit start
|
+// CraftBukkit start
|
||||||
|
@ -34,11 +34,12 @@
|
||||||
+ this.craftInventory = new InventoryCrafting(this, 2, 2, playerinventory.player); // CraftBukkit - pass player
|
+ 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.craftInventory.resultInventory = this.resultInventory; // CraftBukkit - let InventoryCrafting know about its result slot
|
||||||
+ this.player = playerinventory; // CraftBukkit - save player
|
+ this.player = playerinventory; // CraftBukkit - save player
|
||||||
|
+ setTitle(new ChatMessage("container.crafting")); // SPIGOT-4722: Allocate title for player inventory
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 154, 28)));
|
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 154, 28)));
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
@@ -79,7 +96,7 @@
|
@@ -79,7 +97,7 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void a(IInventory iinventory) {
|
public void a(IInventory iinventory) {
|
||||||
|
@ -47,7 +48,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -182,4 +199,17 @@
|
@@ -182,4 +200,17 @@
|
||||||
public int h() {
|
public int h() {
|
||||||
return this.craftInventory.f();
|
return this.craftInventory.f();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue