PaperMC/Spigot-API-Patches/0049-Add-configuration-option-to-prevent-player-names-fro.patch
Aikar 3a70bed5f4
Updated Upstream (Bukkit/CraftBukkit) for LootTable API
I have tested that the Replenishing Feature still works as expected.
Lootable API's that now have Bukkit equivalents are now deprecated.

Bukkit Changes:
f0f33981 SPIGOT-1936: LootTable API

CraftBukkit Changes:
c0df4b82 SPIGOT-1936: LootTable API
2018-08-12 13:11:13 -04:00

62 lines
2.4 KiB
Diff

From ce02b7367e49e0538751330743bf6a07a1183727 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 37bf146dc..a8234e626 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1316,6 +1316,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 765efbc31..f164137e4 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1133,4 +1133,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 2abe1208f..c660c178c 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.18.0