13
0
geforkt von Mirrors/Paper

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>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2014-08-06 20:29:26 +02:00
Ursprung e5b1ff6d1d
Commit b92795e7e8

Datei anzeigen

@ -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);
}
}