diff options
Diffstat (limited to 'patches/server/0010-Adventure.patch')
-rw-r--r-- | patches/server/0010-Adventure.patch | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index 1f91dc9cc3..906c9d1f54 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -4886,7 +4886,7 @@ index 9e05a8515c5f6f340182e91150fcad8bbf80a22b..adf22ce4f0bcd3bd57dc2030c6c92d3d @Override public CraftMerchant getCraftMerchant() { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -index 3ab6b212001c2b92cac42c0ff97e59c3d08b3e49..552ebe67f87b48734adf0da8ef78dcac9dd670a2 100644 +index 3ab6b212001c2b92cac42c0ff97e59c3d08b3e49..32e5188442551b3e72e1d4826d836d622d0e438a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java @@ -2,8 +2,9 @@ package org.bukkit.craftbukkit.inventory; @@ -4900,7 +4900,7 @@ index 3ab6b212001c2b92cac42c0ff97e59c3d08b3e49..552ebe67f87b48734adf0da8ef78dcac import java.util.ArrayList; import java.util.Arrays; import java.util.List; -@@ -170,6 +171,130 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta, WritableBo +@@ -170,6 +171,128 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta, WritableBo public void setGeneration(Generation generation) { } @@ -4927,15 +4927,13 @@ index 3ab6b212001c2b92cac42c0ff97e59c3d08b3e49..552ebe67f87b48734adf0da8ef78dcac + + @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(); + } @@ -5031,7 +5029,7 @@ index 3ab6b212001c2b92cac42c0ff97e59c3d08b3e49..552ebe67f87b48734adf0da8ef78dcac @Override public String getPage(final int page) { Preconditions.checkArgument(this.isValidPage(page), "Invalid page number (%s)", page); -@@ -286,7 +411,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta, WritableBo +@@ -286,7 +409,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta, WritableBo } @Override @@ -5041,7 +5039,7 @@ index 3ab6b212001c2b92cac42c0ff97e59c3d08b3e49..552ebe67f87b48734adf0da8ef78dcac if (this.pages != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java -index c71a4971f127fdfc753306019313ce1a31201120..162997fc80dfe2df1f13c802c1b610f04cb9d05a 100644 +index c71a4971f127fdfc753306019313ce1a31201120..fd3b12477c30d1eabdbe57ea779027931e9dd957 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java @@ -346,7 +346,7 @@ public class CraftMetaBookSigned extends CraftMetaItem implements BookMeta { @@ -5053,7 +5051,7 @@ index c71a4971f127fdfc753306019313ce1a31201120..162997fc80dfe2df1f13c802c1b610f0 super.serialize(builder); if (this.hasTitle()) { -@@ -459,4 +459,113 @@ public class CraftMetaBookSigned extends CraftMetaItem implements BookMeta { +@@ -459,4 +459,111 @@ public class CraftMetaBookSigned extends CraftMetaItem implements BookMeta { return this.spigot; } // Spigot end @@ -5120,15 +5118,13 @@ index c71a4971f127fdfc753306019313ce1a31201120..162997fc80dfe2df1f13c802c1b610f0 + + @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)); + } + @@ -5592,7 +5588,7 @@ index ff040613083c015d9c52c0995591b64305fd5018..1b552b3f05ac7fc44450de4b1ec78907 boolean hadFormat = false; diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 65b92a787b131984ad3e48d8dd6812e1b433c77f..1bf1f10f8691922a69cd13c6a4e643b863801b4f 100644 +index aa6a9dcd5528df38dddc0c661334c35658a19cee..5a89b9ca6a62f0bfb5fe01ed4097870788cf5d83 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -77,6 +77,43 @@ public final class CraftMagicNumbers implements UnsafeValues { |