geforkt von Mirrors/Paper
60 Zeilen
2.6 KiB
Diff
60 Zeilen
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 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 6f2b67774a989ade2ec8acafd9f5288d51fb2102..c5b6e5fa0cfd876733b2010494ad7bbeafc789f8 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -1622,6 +1622,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
|
|
|
|
@NotNull
|
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
|
index 339463eb75e3cb4a9d025892835d54b6ce76c478..457007005f9ff5f6818c559635379a2e698fc4d7 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1420,4 +1420,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 7f153000eee0f563ee4f1e3c218aadb5b6a33a97..1e126487de534ddd634d9a87b9c816d6d09fd467 100644
|
|
--- a/src/main/java/org/bukkit/command/PluginCommand.java
|
|
+++ b/src/main/java/org/bukkit/command/PluginCommand.java
|
|
@@ -151,6 +151,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;
|