diff --git a/Spigot-API-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch b/Spigot-API-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch index f64a7be6d6..ea4eba7e33 100644 --- a/Spigot-API-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch +++ b/Spigot-API-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch @@ -18,9 +18,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.bukkit.entity.Player; import org.bukkit.entity.minecart.CommandMinecart; @@ -0,0 +0,0 @@ public abstract class Command { - return matchedPlayers; - } - + * @throws IllegalArgumentException if sender, alias, or args is null + */ + public List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { ++ // PaperSpigot - location tab-completes ++ /* ++ To prevent infinite recursion, this implementation has been moved down to ++ tabCompleteImpl(CommandSender sender, String alias, String[] args). The infinite recursion happens when ++ a subclass calls super.tabComplete(CommandSender sender, String alias, String[] args, Location location), ++ which would end up calling tabComplete(CommandSender sender, String alias, String[] args), but rather than ++ this method, it would call the overridden method, which would call super.tabComplete again, etc. To prevent ++ this we move the actual main logic to a separate private method. ++ */ ++ return tabCompleteImpl(sender, alias, args); ++ } ++ + // PaperSpigot start - location tab-completes + /** + * Executed on tab completion for this command, returning a list of options the player can tab through. This method @@ -41,13 +53,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + public List tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException { + // Simply default to the standard tab-complete, subclasses can override this if needed -+ return tabComplete(sender, alias, args); ++ return tabCompleteImpl(sender, alias, args); + } -+ // PaperSpigot end + ++ private List tabCompleteImpl(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { + Validate.notNull(sender, "Sender cannot be null"); + Validate.notNull(args, "Arguments cannot be null"); + Validate.notNull(alias, "Alias cannot be null"); +@@ -0,0 +0,0 @@ public abstract class Command { + Collections.sort(matchedPlayers, String.CASE_INSENSITIVE_ORDER); + return matchedPlayers; + } ++ // PaperSpigot end + /** * Returns the name of this command - * diff --git a/src/main/java/org/bukkit/command/PluginCommand.java b/src/main/java/org/bukkit/command/PluginCommand.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/command/PluginCommand.java diff --git a/Spigot-API-Patches/Fix-infinite-recursion-with-plugin-tab-completers.patch b/Spigot-API-Patches/Fix-infinite-recursion-with-plugin-tab-completers.patch deleted file mode 100644 index 1f2b247a1b..0000000000 --- a/Spigot-API-Patches/Fix-infinite-recursion-with-plugin-tab-completers.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: DemonWav -Date: Sun, 31 Jan 2016 01:20:21 -0600 -Subject: [PATCH] Fix infinite recursion with plugin tab completers - - -diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/command/Command.java -+++ b/src/main/java/org/bukkit/command/Command.java -@@ -0,0 +0,0 @@ public abstract class Command { - * @throws IllegalArgumentException if sender, alias, or args is null - */ - public List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { -- Validate.notNull(sender, "Sender cannot be null"); -- Validate.notNull(args, "Arguments cannot be null"); -- Validate.notNull(alias, "Alias cannot be null"); -- -- if (args.length == 0) { -- return ImmutableList.of(); -- } -- -- String lastWord = args[args.length - 1]; -- -- Player senderPlayer = sender instanceof Player ? (Player) sender : null; -- -- ArrayList matchedPlayers = new ArrayList(); -- for (Player player : sender.getServer().getOnlinePlayers()) { -- String name = player.getName(); -- if ((senderPlayer == null || senderPlayer.canSee(player)) && StringUtil.startsWithIgnoreCase(name, lastWord)) { -- matchedPlayers.add(name); -- } -- } -- -- Collections.sort(matchedPlayers, String.CASE_INSENSITIVE_ORDER); -- return matchedPlayers; -+ // PaperSpigot - location tab-completes -+ /* -+ To prevent infinite recursion, this implementation has been moved down to -+ tabCompleteImpl(CommandSender sender, String alias, String[] args). The infinite recursion happens when -+ a subclass calls super.tabComplete(CommandSender sender, String alias, String[] args, Location location), -+ which would end up calling tabComplete(CommandSender sender, String alias, String[] args), but rather than -+ this method, it would call the overridden method, which would call super.tabComplete again, etc. To prevent -+ this we move the actual main logic to a separate private method. -+ */ -+ return tabCompleteImpl(sender, alias, args); - } - - // PaperSpigot start - location tab-completes -@@ -0,0 +0,0 @@ public abstract class Command { - */ - public List tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException { - // Simply default to the standard tab-complete, subclasses can override this if needed -- return tabComplete(sender, alias, args); -+ return tabCompleteImpl(sender, alias, args); -+ } -+ -+ private List tabCompleteImpl(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { -+ Validate.notNull(sender, "Sender cannot be null"); -+ Validate.notNull(args, "Arguments cannot be null"); -+ Validate.notNull(alias, "Alias cannot be null"); -+ -+ if (args.length == 0) { -+ return ImmutableList.of(); -+ } -+ -+ String lastWord = args[args.length - 1]; -+ -+ Player senderPlayer = sender instanceof Player ? (Player) sender : null; -+ -+ ArrayList matchedPlayers = new ArrayList(); -+ for (Player player : sender.getServer().getOnlinePlayers()) { -+ String name = player.getName(); -+ if ((senderPlayer == null || senderPlayer.canSee(player)) && StringUtil.startsWithIgnoreCase(name, lastWord)) { -+ matchedPlayers.add(name); -+ } -+ } -+ -+ Collections.sort(matchedPlayers, String.CASE_INSENSITIVE_ORDER); -+ return matchedPlayers; - } - // PaperSpigot end - -@@ -0,0 +0,0 @@ public abstract class Command { - public String toString() { - return getClass().getName() + '(' + name + ')'; - } --} -+} -\ No newline at end of file --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch b/Spigot-Server-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch index 9c9c499434..574fb2a0c4 100644 --- a/Spigot-Server-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch +++ b/Spigot-Server-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch @@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - completions = getCommandMap().tabComplete(player, message.substring(1)); + // send location info if present + // completions = getCommandMap().tabComplete(player, message.substring(1)); -+ if (blockPosition == null) { ++ if (blockPosition == null || !((CraftWorld) player.getWorld()).getHandle().paperSpigotConfig.allowBlockLocationTabCompletion) { + completions = getCommandMap().tabComplete(player, message.substring(1)); + } else { + completions = getCommandMap().tabComplete(player, message.substring(1), new Location(player.getWorld(), blockPosition.getX(), blockPosition.getY(), blockPosition.getZ())); @@ -133,4 +133,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static CommandSender lastSender = null; // Nasty :( +diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java ++++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig + { + allChunksAreSlimeChunks = getBoolean( "all-chunks-are-slime-chunks", false ); + } ++ ++ public boolean allowBlockLocationTabCompletion; ++ private void allowBlockLocationTabCompletion() ++ { ++ allowBlockLocationTabCompletion = getBoolean( "allow-block-location-tab-completion", true ); ++ } + } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Make-block-location-tab-completion-be-a-per-world-co.patch b/Spigot-Server-Patches/Make-block-location-tab-completion-be-a-per-world-co.patch deleted file mode 100644 index b688f794b7..0000000000 --- a/Spigot-Server-Patches/Make-block-location-tab-completion-be-a-per-world-co.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: DemonWav -Date: Sun, 31 Jan 2016 01:21:03 -0600 -Subject: [PATCH] Make block location tab completion be a per-world - configurable value - - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -0,0 +0,0 @@ public final class CraftServer implements Server { - try { - // send location info if present - // completions = getCommandMap().tabComplete(player, message.substring(1)); -- if (blockPosition == null) { -+ if (blockPosition == null || !((CraftWorld) player.getWorld()).getHandle().paperSpigotConfig.allowBlockLocationTabCompletion) { - completions = getCommandMap().tabComplete(player, message.substring(1)); - } else { - completions = getCommandMap().tabComplete(player, message.substring(1), new Location(player.getWorld(), blockPosition.getX(), blockPosition.getY(), blockPosition.getZ())); -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - { - allChunksAreSlimeChunks = getBoolean( "all-chunks-are-slime-chunks", false ); - } -+ -+ public boolean allowBlockLocationTabCompletion; -+ private void allowBlockLocationTabCompletion() -+ { -+ allowBlockLocationTabCompletion = getBoolean( "allow-block-location-tab-completion", true ); -+ } - } --- \ No newline at end of file