From b92795e7e84fabca4e86e574e7bff6511a816265 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 6 Aug 2014 20:29:26 +0200 Subject: [PATCH] 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 --- .../main/java/org/bukkit/command/defaults/DeopCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/command/defaults/DeopCommand.java b/paper-api/src/main/java/org/bukkit/command/defaults/DeopCommand.java index 1b71d493e9..c46750a778 100644 --- a/paper-api/src/main/java/org/bukkit/command/defaults/DeopCommand.java +++ b/paper-api/src/main/java/org/bukkit/command/defaults/DeopCommand.java @@ -49,9 +49,9 @@ public class DeopCommand extends VanillaCommand { if (args.length == 1) { List completions = new ArrayList(); - 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); } }