mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-23 08:46:44 +01:00
Only loop through op players when tab completing /deop Fixes BUKKIT-5748
When tab completing /deop, a potentially large set of players is used for finding suitable player names. This potentially large set of players can cause performance concerns on servers. To fix this, only the set of operators should be considered for the /deop tab completion where the player set is much more relevant and follows suit with other commands which employ "more specific" player sets when possible. This commit adds this more efficient behaviour. By: bendem <online@bendem.be>
This commit is contained in:
parent
e5b1ff6d1d
commit
b92795e7e8
1 changed files with 2 additions and 2 deletions
|
@ -49,9 +49,9 @@ public class DeopCommand extends VanillaCommand {
|
|||
|
||||
if (args.length == 1) {
|
||||
List<String> completions = new ArrayList<String>();
|
||||
for (OfflinePlayer player : Bukkit.getOfflinePlayers()) {
|
||||
for (OfflinePlayer player : Bukkit.getOperators()) {
|
||||
String playerName = player.getName();
|
||||
if (player.isOp() && StringUtil.startsWithIgnoreCase(playerName, args[0])) {
|
||||
if (StringUtil.startsWithIgnoreCase(playerName, args[0])) {
|
||||
completions.add(playerName);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue