3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 19:10:09 +01:00
Paper/Bukkit-Patches/0028-Fix-slow-tab-complete-for-some-commands.patch
Zach Brown 4aef5602d5 Update from upstream SpigotMC
Remove defensive copy in EAR SpigotMC/Spigot@f1ba1f6c07
Make "moved wrongly limit" configurable SpigotMC/Spigot@f7ab380e16
Fix null Tile Entity Worlds (we already had this) SpigotMC/Spigot@b271cdbfa0
Fix slow tab complete for some commands SpigotMC/Spigot@f3b7952c73
Only suggest ops to deop and remove whitelist add case entirely SpigotMC/Spigot@0e1fcfbe70
Allow tab complete for /whitelist add SpigotMC/Spigot@27f8aa22bd
2014-07-22 15:25:09 -05:00

37 Zeilen
2.0 KiB
Diff

From 1aa49f17b57768c68ddfe4be0a7ec9f86d0facbc 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/DeopCommand.java b/src/main/java/org/bukkit/command/defaults/DeopCommand.java
index 1b71d49..8a571e8 100644
--- a/src/main/java/org/bukkit/command/defaults/DeopCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/DeopCommand.java
@@ -49,7 +49,7 @@ public class DeopCommand extends VanillaCommand {
if (args.length == 1) {
List<String> completions = new ArrayList<String>();
- for (OfflinePlayer player : Bukkit.getOfflinePlayers()) {
+ for (OfflinePlayer player : Bukkit.getOnlinePlayers()) { // Spigot - offline players is slow
String playerName = player.getName();
if (player.isOp() && StringUtil.startsWithIgnoreCase(playerName, args[0])) {
completions.add(playerName);
diff --git a/src/main/java/org/bukkit/command/defaults/WhitelistCommand.java b/src/main/java/org/bukkit/command/defaults/WhitelistCommand.java
index b3fa4f8..fd81ee3 100644
--- a/src/main/java/org/bukkit/command/defaults/WhitelistCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/WhitelistCommand.java
@@ -104,7 +104,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 - offline players is slow
String name = player.getName();
if (StringUtil.startsWithIgnoreCase(name, args[1]) && !player.isWhitelisted()) {
completions.add(name);
--
1.9.1