geforkt von Mirrors/Paper
Fix a couple of ItemMeta related NPEs (#11149)
Dieser Commit ist enthalten in:
Ursprung
0139f28d62
Commit
61ad933f4d
@ -4927,15 +4927,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.Component page(final int page) {
|
||||
+ Preconditions.checkArgument(this.isValidPage(page), "Invalid page number");
|
||||
+ Preconditions.checkArgument(this.isValidPage(page), "Invalid page number (%s/%s)", page, this.getPageCount());
|
||||
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(this.pages.get(page - 1));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void page(final int page, net.kyori.adventure.text.Component data) {
|
||||
+ if (!this.isValidPage(page)) {
|
||||
+ throw new IllegalArgumentException("Invalid page number " + page + "/" + this.pages.size());
|
||||
+ }
|
||||
+ Preconditions.checkArgument(this.isValidPage(page), "Invalid page number (%s/%s)", page, this.getPageCount());
|
||||
+ if (data == null) {
|
||||
+ data = net.kyori.adventure.text.Component.empty();
|
||||
+ }
|
||||
@ -5120,15 +5118,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.Component page(final int page) {
|
||||
+ Preconditions.checkArgument(this.isValidPage(page), "Invalid page number");
|
||||
+ Preconditions.checkArgument(this.isValidPage(page), "Invalid page number (%s/%s)", page, this.getPageCount());
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.pages.get(page - 1));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void page(final int page, net.kyori.adventure.text.Component data) {
|
||||
+ if (!this.isValidPage(page)) {
|
||||
+ throw new IllegalArgumentException("Invalid page number " + page + "/" + this.pages.size());
|
||||
+ }
|
||||
+ Preconditions.checkArgument(this.isValidPage(page), "Invalid page number (%s/%s)", page, this.getPageCount());
|
||||
+ this.pages.set(page - 1, io.papermc.paper.adventure.PaperAdventure.asVanillaNullToEmpty(data));
|
||||
+ }
|
||||
+
|
||||
|
@ -71,6 +71,16 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack {
|
||||
|
||||
@Override
|
||||
public void removeEnchantments() {
|
||||
+ if (this.handle != null) { // Paper - fix NPE
|
||||
this.handle.remove(DataComponents.ENCHANTMENTS);
|
||||
+ } // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack {
|
||||
// Paper end - improve handled tags on type change
|
||||
// Paper start
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren