Paper/Spigot-API-Patches/0051-Add-configuration-option-to-prevent-player-names-fro.patch
Zach Brown fe4678c414
Properly fix JavaDoc linting issues
Fixes our own, and upstream's, issues with the stricter Java 8 JavaDoc
linter.

Also removes the destroystokyo-release maven repository. I'm not sure
why I added it originally, but it's unnecessary now.
2017-06-10 17:12:48 -05:00

63 lines
2.4 KiB
Diff

From c1215b45d6da3da9cc9cbdee0f618551b80ebff0 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Fri, 9 Jun 2017 07:24:24 -0700
Subject: [PATCH] Add configuration option to prevent player names from being
suggested
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 498dfd33..4f27b9f2 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1206,6 +1206,16 @@ public final class Bukkit {
public static boolean reloadCommandAliases() {
return server.reloadCommandAliases();
}
+
+ /**
+ * Checks if player names should be suggested when a command returns {@code null} as
+ * their tab completion result.
+ *
+ * @return true if player names should be suggested
+ */
+ public static boolean suggestPlayerNamesWhenNullTabCompletions() {
+ return server.suggestPlayerNamesWhenNullTabCompletions();
+ }
// Paper end
public static Server.Spigot spigot()
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 4f077b7c..3a27e3ae 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1032,4 +1032,14 @@ public interface Server extends PluginMessageRecipient {
void reloadPermissions(); // Paper
boolean reloadCommandAliases(); // Paper
+
+ // Paper start - allow preventing player name suggestions by default
+ /**
+ * Checks if player names should be suggested when a command returns {@code null} as
+ * their tab completion result.
+ *
+ * @return true if player names should be suggested
+ */
+ boolean suggestPlayerNamesWhenNullTabCompletions();
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/command/PluginCommand.java b/src/main/java/org/bukkit/command/PluginCommand.java
index 3bfa31fc..dbbf0a42 100644
--- a/src/main/java/org/bukkit/command/PluginCommand.java
+++ b/src/main/java/org/bukkit/command/PluginCommand.java
@@ -145,6 +145,7 @@ public final class PluginCommand extends Command implements PluginIdentifiableCo
}
if (completions == null) {
+ if (!sender.getServer().suggestPlayerNamesWhenNullTabCompletions()) return com.google.common.collect.ImmutableList.of(); // Paper - allow preventing player name suggestions by default
return super.tabComplete(sender, alias, args);
}
return completions;
--
2.13.0.windows.1