Fix suggest-player-names-when-null-tab-completions - Fixes #3803

Seems changes upstream broke original implementation

moved check into method that actually does the injection
This commit is contained in:
Aikar 2020-07-05 03:11:54 -04:00
parent 166e52b574
commit 97f920bf19
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
1 changed files with 11 additions and 10 deletions

View File

@ -45,15 +45,16 @@ index 339463eb75e3cb4a9d025892835d54b6ce76c478..457007005f9ff5f6818c559635379a2e
+ 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
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
index 03bdc1622791e1206406c87065978688d602e39e..7c80dc54776d0d66f7816b77136f6dbd9b801704 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 {
Validate.notNull(args, "Arguments cannot be null");
Validate.notNull(alias, "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();
}
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;