mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
Add configuration option to prevent player names from being suggested
This commit is contained in:
parent
f0d3438c11
commit
f7eff332be
3 changed files with 21 additions and 1 deletions
|
@ -2412,6 +2412,16 @@ public final class Bukkit {
|
||||||
public static boolean reloadCommandAliases() {
|
public static boolean reloadCommandAliases() {
|
||||||
return server.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
|
// Paper end
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
@ -2100,4 +2100,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
void reloadPermissions(); // Paper
|
void reloadPermissions(); // Paper
|
||||||
|
|
||||||
boolean reloadCommandAliases(); // 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
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ public abstract class Command {
|
||||||
Preconditions.checkArgument(args != null, "Arguments cannot be null");
|
Preconditions.checkArgument(args != null, "Arguments cannot be null");
|
||||||
Preconditions.checkArgument(alias != null, "Alias 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();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue