mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 18:31:29 +01:00
61 lines
2.6 KiB
Diff
61 lines
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 22d9538abe61ccb3e5d3ae407d54446fa172fa39..68a79316cec0c4ab83c6f986e3a9561440994319 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -2192,6 +2192,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 26516ae5519675dac359b578d0f06ea2c0745ab3..0cf214c45078d83d678f12f6cb350e50fc5f1e94 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1927,4 +1927,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
|
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/Command.java b/src/main/java/org/bukkit/command/Command.java
|
|
index 5cfd88eec9bf02e83d77b6fce1a5c14b7687f48b..1c6205cc667bbec8f6aca479f13b3e9cfcd63ab2 100644
|
|
--- a/src/main/java/org/bukkit/command/Command.java
|
|
+++ b/src/main/java/org/bukkit/command/Command.java
|
|
@@ -99,7 +99,7 @@ public abstract class Command {
|
|
Preconditions.checkArgument(args != null, "Arguments cannot be null");
|
|
Preconditions.checkArgument(alias != null, "Alias cannot be null");
|
|
|
|
- if (args.length == 0) {
|
|
+ if (args.length == 0 || !sender.getServer().suggestPlayerNamesWhenNullTabCompletions()) { // Paper - allow preventing player name suggestions by default) {
|
|
return ImmutableList.of();
|
|
}
|
|
|