mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Add configuration option to prevent player names from being suggested
This commit is contained in:
parent
e68554e5c6
commit
991082d2a2
2 changed files with 97 additions and 0 deletions
|
@ -0,0 +1,60 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Riley Park <rileysebastianpark@gmail.com>
|
||||
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 4c20a1be..b7f0d5d9 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
--
|
|
@ -0,0 +1,37 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Riley Park <rileysebastianpark@gmail.com>
|
||||
Date: Fri, 9 Jun 2017 07:24:34 -0700
|
||||
Subject: [PATCH] Add configuration option to prevent player names from being
|
||||
suggested
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 28917f63..f4b23703 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
}
|
||||
removeInvalidStatistics = getBoolean("settings.remove-invalid-statistics", false);
|
||||
}
|
||||
+
|
||||
+ public static boolean suggestPlayersWhenNullTabCompletions = true;
|
||||
+ private static void suggestPlayersWhenNull() {
|
||||
+ suggestPlayersWhenNullTabCompletions = getBoolean("settings.suggest-player-names-when-null-tab-completions", suggestPlayersWhenNullTabCompletions);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index d515ef0f..463f5890 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 {
|
||||
commandMap.registerServerAliases();
|
||||
return true;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean suggestPlayerNamesWhenNullTabCompletions() {
|
||||
+ return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions;
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
--
|
Loading…
Reference in a new issue