diff --git a/patches/api/0005-Adventure.patch b/patches/api/0005-Adventure.patch index 1703888fa5..f88194f813 100644 --- a/patches/api/0005-Adventure.patch +++ b/patches/api/0005-Adventure.patch @@ -3218,7 +3218,7 @@ index 03bfca9d368bbe4b7c1353d52c883e756bf69bda..943d324435350d3f16fad3e21cb472a0 /** diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java -index b9abfdc61f76c5562de6649f8440aeaab536b3be..12cdae95c338d21684991d34aea5a643f4b4bcd3 100644 +index b9abfdc61f76c5562de6649f8440aeaab536b3be..c4644f3fd231bff35627ff667e37ccdefbfdbb88 100644 --- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java +++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java @@ -21,15 +21,16 @@ public class ServerListPingEvent extends ServerEvent implements Iterable @@ -3257,7 +3257,7 @@ index b9abfdc61f76c5562de6649f8440aeaab536b3be..12cdae95c338d21684991d34aea5a643 + // Paper start + public ServerListPingEvent(@NotNull final InetAddress address, @NotNull final net.kyori.adventure.text.Component motd, final int numPlayers, final int maxPlayers) { + super(true); -+ Validate.isTrue(numPlayers >= 0, "Cannot have negative number of players online", numPlayers); ++ Preconditions.checkArgument(numPlayers >= 0, "Cannot have negative number of players online (%s)", numPlayers); + this.address = address; this.motd = motd; + this.numPlayers = numPlayers; diff --git a/patches/api/0020-Add-exception-reporting-event.patch b/patches/api/0020-Add-exception-reporting-event.patch index bfb88b8fae..6b6b666c79 100644 --- a/patches/api/0020-Add-exception-reporting-event.patch +++ b/patches/api/0020-Add-exception-reporting-event.patch @@ -6,14 +6,13 @@ Subject: [PATCH] Add exception reporting event diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..2f573299a9a817a98372817a1de8bf641aaca956 +index 0000000000000000000000000000000000000000..306dbd975e9380c22dae0dad526725cc47a36f16 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java -@@ -0,0 +1,43 @@ +@@ -0,0 +1,42 @@ +package com.destroystokyo.paper.event.server; + +import com.google.common.base.Preconditions; -+import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; diff --git a/patches/api/0034-Add-MetadataStoreBase.removeAll-Plugin.patch b/patches/api/0034-Add-MetadataStoreBase.removeAll-Plugin.patch index 1f2d666fc0..2496de7423 100644 --- a/patches/api/0034-Add-MetadataStoreBase.removeAll-Plugin.patch +++ b/patches/api/0034-Add-MetadataStoreBase.removeAll-Plugin.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add MetadataStoreBase.removeAll(Plugin) So that on reload, metadata will be cleared diff --git a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java -index a0698522f01619c9d37474f4bd55a17de58fff89..dae60d0df3ccb28ab65214e205312afcd04aa770 100644 +index a0698522f01619c9d37474f4bd55a17de58fff89..a298baaa7a126515bb2802dd311f8487f3e5533f 100644 --- a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java +++ b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java @@ -5,6 +5,7 @@ import java.util.ArrayList; @@ -29,7 +29,7 @@ index a0698522f01619c9d37474f4bd55a17de58fff89..dae60d0df3ccb28ab65214e205312afc + * @throws IllegalArgumentException If plugin is null + */ + public void removeAll(@NotNull Plugin owningPlugin) { -+ Validate.notNull(owningPlugin, "Plugin cannot be null"); ++ Preconditions.checkNotNull(owningPlugin, "Plugin cannot be null"); + for (Iterator> iterator = metadataMap.values().iterator(); iterator.hasNext(); ) { + Map values = iterator.next(); + if (values.containsKey(owningPlugin)) { diff --git a/patches/api/0075-AsyncTabCompleteEvent.patch b/patches/api/0075-AsyncTabCompleteEvent.patch index b64cdef9d3..c6d6dc4ba4 100644 --- a/patches/api/0075-AsyncTabCompleteEvent.patch +++ b/patches/api/0075-AsyncTabCompleteEvent.patch @@ -13,10 +13,10 @@ completion, such as offline players. diff --git a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..619ed37169c126a8c75d02699a04728bac49d10d +index 0000000000000000000000000000000000000000..a135a9bfb2ccc8842baa9d5760fa05b7b1a529b1 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java -@@ -0,0 +1,177 @@ +@@ -0,0 +1,176 @@ +/* + * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License + * @@ -42,8 +42,7 @@ index 0000000000000000000000000000000000000000..619ed37169c126a8c75d02699a04728b + +package com.destroystokyo.paper.event.server; + -+import com.google.common.collect.ImmutableList; -+import org.apache.commons.lang.Validate; ++import com.google.common.base.Preconditions; +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; @@ -117,7 +116,7 @@ index 0000000000000000000000000000000000000000..619ed37169c126a8c75d02699a04728b + * @param completions the new completions + */ + public void setCompletions(@NotNull List completions) { -+ Validate.notNull(completions); ++ Preconditions.checkNotNull(completions); + this.completions = new ArrayList<>(completions); + } + diff --git a/patches/api/0169-Add-ItemStack-Recipe-API-helper-methods.patch b/patches/api/0169-Add-ItemStack-Recipe-API-helper-methods.patch index 8b237c6920..cba58643e4 100644 --- a/patches/api/0169-Add-ItemStack-Recipe-API-helper-methods.patch +++ b/patches/api/0169-Add-ItemStack-Recipe-API-helper-methods.patch @@ -24,7 +24,7 @@ index ad2ab6e97ccf6900d19f8bfbe08181d4c7743a99..ecf8cd763ae600c11be6385ea6240e4d * Get a copy of the ingredients map. * diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java -index 75b47c608d0a902e4ea5f03c395667f47dec8980..ba4fb2356c63dd0e1c14f373a699b87e2e25562c 100644 +index 75b47c608d0a902e4ea5f03c395667f47dec8980..ff5a0e378a7c1e0f89d81144629251dc61af6355 100644 --- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java @@ -142,6 +142,40 @@ public class ShapelessRecipe implements Recipe, Keyed { @@ -39,7 +39,7 @@ index 75b47c608d0a902e4ea5f03c395667f47dec8980..ba4fb2356c63dd0e1c14f373a699b87e + + @NotNull + public ShapelessRecipe addIngredient(int count, @NotNull ItemStack item) { -+ Validate.isTrue(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients"); ++ Preconditions.checkArgument(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients"); + while (count-- > 0) { + ingredients.add(new RecipeChoice.ExactChoice(item)); + } diff --git a/patches/api/0279-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch b/patches/api/0279-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch index 70c19ffd10..fe3d224a62 100644 --- a/patches/api/0279-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch +++ b/patches/api/0279-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch @@ -6,22 +6,22 @@ Subject: [PATCH] Allow for Component suggestion tooltips in diff --git a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java -index 619ed37169c126a8c75d02699a04728bac49d10d..4cd97cb102e1ec53b3fe1a451b65b4b640fde099 100644 +index a135a9bfb2ccc8842baa9d5760fa05b7b1a529b1..9be64a95c2345433b6142d611077dedadcef9f5d 100644 --- a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java @@ -24,6 +24,11 @@ package com.destroystokyo.paper.event.server; - import com.google.common.collect.ImmutableList; + import com.google.common.base.Preconditions; +import io.papermc.paper.util.TransformingRandomAccessList; +import net.kyori.adventure.text.Component; +import net.kyori.examination.Examinable; +import net.kyori.examination.ExaminableProperty; +import net.kyori.examination.string.StringExaminer; - import org.apache.commons.lang.Validate; import org.bukkit.Location; import org.bukkit.command.Command; -@@ -34,6 +39,7 @@ import org.bukkit.event.HandlerList; + import org.bukkit.command.CommandSender; +@@ -33,6 +38,7 @@ import org.bukkit.event.HandlerList; import java.util.ArrayList; import java.util.List; @@ -29,7 +29,7 @@ index 619ed37169c126a8c75d02699a04728bac49d10d..4cd97cb102e1ec53b3fe1a451b65b4b6 import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@@ -48,15 +54,29 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable { +@@ -47,15 +53,29 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable { private final boolean isCommand; @Nullable private final Location loc; @@ -61,7 +61,7 @@ index 619ed37169c126a8c75d02699a04728bac49d10d..4cd97cb102e1ec53b3fe1a451b65b4b6 this.buffer = buffer; this.isCommand = isCommand; this.loc = loc; -@@ -84,7 +104,7 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable { +@@ -83,7 +103,7 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable { */ @NotNull public List getCompletions() { @@ -70,14 +70,14 @@ index 619ed37169c126a8c75d02699a04728bac49d10d..4cd97cb102e1ec53b3fe1a451b65b4b6 } /** -@@ -98,8 +118,42 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable { +@@ -97,8 +117,42 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable { * @param completions the new completions */ public void setCompletions(@NotNull List completions) { + if (completions == this.stringCompletions) { + return; + } - Validate.notNull(completions); + Preconditions.checkNotNull(completions); - this.completions = new ArrayList<>(completions); + this.completions.clear(); + this.completions.addAll(fromStrings(completions)); @@ -108,13 +108,13 @@ index 619ed37169c126a8c75d02699a04728bac49d10d..4cd97cb102e1ec53b3fe1a451b65b4b6 + * @param newCompletions the new completions + */ + public void completions(final @NotNull List newCompletions) { -+ Validate.notNull(newCompletions, "new completions"); ++ Preconditions.checkNotNull(newCompletions, "new completions"); + this.completions.clear(); + this.completions.addAll(newCompletions); } /** -@@ -174,4 +228,102 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable { +@@ -173,4 +227,102 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable { public static HandlerList getHandlerList() { return handlers; }