Paper/Bukkit-Patches/0026-Fix-slow-tab-complete-for-some-commands.patch
Zach Brown 6a5e553feb Update from upstream SpigotMC
a3168ab2ce4
9b45d9fa8d3
b43a31a5c25
a926b96d5d1
d6b5ba7ca03
bb782d07aed
5a74d55c678
47b1dff3e68 [M]
2014-12-18 17:33:08 -06:00

24 Zeilen
1.2 KiB
Diff

From 1a959c79f570df505027e28a1178174b921bf329 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Tue, 22 Jul 2014 21:01:32 +1000
Subject: [PATCH] Fix slow tab complete for some commands.
Use online players instead of offline players, which is very slow.
diff --git a/src/main/java/org/bukkit/command/defaults/WhitelistCommand.java b/src/main/java/org/bukkit/command/defaults/WhitelistCommand.java
index 92de43c..855f560 100644
--- a/src/main/java/org/bukkit/command/defaults/WhitelistCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/WhitelistCommand.java
@@ -105,7 +105,7 @@ public class WhitelistCommand extends VanillaCommand {
} else if (args.length == 2) {
if (args[0].equalsIgnoreCase("add")) {
List<String> completions = new ArrayList<String>();
- for (OfflinePlayer player : Bukkit.getOfflinePlayers()) {
+ for (OfflinePlayer player : Bukkit.getOnlinePlayers()) { // Spigot - well maybe sometimes you haven't turned the whitelist on just yet.
String name = player.getName();
if (StringUtil.startsWithIgnoreCase(name, args[1]) && !player.isWhitelisted()) {
completions.add(name);
--
2.1.0