From 31cb1e6df5ba1db15090209113275c03433d0532 Mon Sep 17 00:00:00 2001 From: bendem Date: Wed, 6 Aug 2014 20:29:26 +0200 Subject: 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. --- src/main/java/org/bukkit/command/defaults/DeopCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/org/bukkit/command/defaults/DeopCommand.java b/src/main/java/org/bukkit/command/defaults/DeopCommand.java index 1b71d493..c46750a7 100644 --- a/src/main/java/org/bukkit/command/defaults/DeopCommand.java +++ b/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); } } -- cgit v1.2.3