diff --git a/Spigot-API-Patches/AsyncTabCompleteEvent.patch b/Spigot-API-Patches/AsyncTabCompleteEvent.patch index b94f81dc82..ee460c7713 100644 --- a/Spigot-API-Patches/AsyncTabCompleteEvent.patch +++ b/Spigot-API-Patches/AsyncTabCompleteEvent.patch @@ -13,7 +13,7 @@ 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 00000000..2fa4cb1c +index 00000000..3071320e --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java @@ -0,0 +0,0 @@ @@ -43,6 +43,7 @@ index 00000000..2fa4cb1c +package com.destroystokyo.paper.event.server; + +import com.google.common.collect.ImmutableList; ++import org.apache.commons.lang.Validate; +import org.bukkit.Location; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; @@ -106,13 +107,13 @@ index 00000000..2fa4cb1c + * the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])} + * or current player names will not be called. + * ++ * The passed collection will be cloned to a new List. You must call {{@link #getCompletions()}} to mutate from here ++ * + * @param completions the new completions + */ + public void setCompletions(List<String> completions) { -+ if (completions instanceof ImmutableList) { -+ completions = new ArrayList<>(completions); -+ } -+ this.completions = completions; ++ Validate.notNull(completions); ++ this.completions = new ArrayList<>(completions); + } + + /** @@ -185,9 +186,16 @@ index 00000000..2fa4cb1c + } +} diff --git a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java -index 6ac437d5..fef57f5f 100644 +index 6ac437d5..df6eb53d 100644 --- a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java +++ b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java +@@ -0,0 +0,0 @@ + package org.bukkit.event.server; + ++import java.util.ArrayList; + import java.util.List; + import org.apache.commons.lang.Validate; + import org.bukkit.command.CommandSender; @@ -0,0 +0,0 @@ public class TabCompleteEvent extends Event implements Cancellable { private boolean cancelled; @@ -227,4 +235,15 @@ index 6ac437d5..fef57f5f 100644 /** * Set the completions offered, overriding any already set. * ++ * The passed collection will be cloned to a new List. You must call {{@link #getCompletions()}} to mutate from here ++ * + * @param completions the new completions + */ + public void setCompletions(List<String> completions) { + Validate.notNull(completions); +- this.completions = completions; ++ this.completions = new ArrayList<>(completions); // Paper + } + + @Override -- \ No newline at end of file