13
0
geforkt von Mirrors/Paper

Return chat component with empty text instead of throwing exception

Dieser Commit ist enthalten in:
CDFN 2020-07-07 17:53:23 +02:00
Ursprung df6902585c
Commit 3daa3905f0

Datei anzeigen

@ -28,11 +28,10 @@
public abstract class AbstractContainerMenu {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -66,6 +80,27 @@
@Nullable
@@ -67,6 +81,32 @@
private ContainerSynchronizer synchronizer;
private boolean suppressRemoteUpdates;
+
+ // CraftBukkit start
+ public boolean checkReachable = true;
+ public abstract InventoryView getBukkitView();
@ -45,7 +44,12 @@
+ }
+ private Component title;
+ public final Component getTitle() {
+ Preconditions.checkState(this.title != null, "Title not set");
+ // Paper start - return chat component with empty text instead of throwing error
+ // Preconditions.checkState(this.title != null, "Title not set");
+ if (this.title == null){
+ return Component.literal("");
+ }
+ // Paper end - return chat component with empty text instead of throwing error
+ return this.title;
+ }
+ public final void setTitle(Component title) {
@ -53,10 +57,11 @@
+ this.title = title;
+ }
+ // CraftBukkit end
+
protected AbstractContainerMenu(@Nullable MenuType<?> type, int syncId) {
this.carried = ItemStack.EMPTY;
@@ -192,6 +227,15 @@
this.remoteSlots = NonNullList.create();
@@ -192,6 +232,15 @@
}
@ -72,7 +77,7 @@
public void removeSlotListener(ContainerListener listener) {
this.containerListeners.remove(listener);
}
@@ -417,7 +461,7 @@
@@ -417,7 +466,7 @@
}
} else if (this.quickcraftStatus == 2) {
if (!this.quickcraftSlots.isEmpty()) {
@ -81,7 +86,7 @@
k = ((Slot) this.quickcraftSlots.iterator().next()).index;
this.resetQuickCraft();
this.doClick(k, this.quickcraftType, ClickType.PICKUP, player);
@@ -433,6 +477,7 @@
@@ -433,6 +482,7 @@
l = this.getCarried().getCount();
Iterator iterator = this.quickcraftSlots.iterator();
@ -89,7 +94,7 @@
while (iterator.hasNext()) {
Slot slot1 = (Slot) iterator.next();
ItemStack itemstack2 = this.getCarried();
@@ -443,12 +488,48 @@
@@ -443,12 +493,48 @@
int l1 = Math.min(AbstractContainerMenu.getQuickCraftPlaceCount(this.quickcraftSlots, this.quickcraftType, itemstack1) + j1, k1);
l -= l1 - j1;
@ -141,7 +146,7 @@
}
this.resetQuickCraft();
@@ -466,8 +547,11 @@
@@ -466,8 +552,11 @@
if (slotIndex == -999) {
if (!this.getCarried().isEmpty()) {
if (clickaction == ClickAction.PRIMARY) {
@ -154,7 +159,7 @@
} else {
player.drop(this.getCarried().split(1), true);
}
@@ -530,6 +614,15 @@
@@ -530,6 +619,15 @@
}
slot.setChanged();
@ -170,7 +175,7 @@
}
} else {
int j2;
@@ -662,8 +755,9 @@
@@ -662,8 +760,9 @@
ItemStack itemstack = this.getCarried();
if (!itemstack.isEmpty()) {
@ -181,7 +186,7 @@
}
}
@@ -893,6 +987,11 @@
@@ -893,6 +992,11 @@
}
public ItemStack getCarried() {