Split out offline player lookups

This commit is contained in:
md_5 2013-06-11 14:02:19 +10:00
parent 45414bbf61
commit 14a70d4c94
1 changed files with 4 additions and 47 deletions

View File

@ -1,6 +1,6 @@
From 0adf31b995d7637074febf78abbdda02291a63c1 Mon Sep 17 00:00:00 2001 From 19439295ea5c0088c27ca8a637ef9a252611ea63 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Tue, 11 Jun 2013 12:16:05 +1000 Date: Tue, 11 Jun 2013 13:55:57 +1000
Subject: [PATCH] Spigot Changes Subject: [PATCH] Spigot Changes
@ -234,7 +234,7 @@ index 6c3fcf1..4a8d3f4 100644
} }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2956e75..6ed5212 100644 index 2956e75..c234cac 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -166,6 +166,13 @@ public final class CraftServer implements Server { @@ -166,6 +166,13 @@ public final class CraftServer implements Server {
@ -289,50 +289,7 @@ index 2956e75..6ed5212 100644
loadPlugins(); loadPlugins();
enablePlugins(PluginLoadOrder.STARTUP); enablePlugins(PluginLoadOrder.STARTUP);
enablePlugins(PluginLoadOrder.POSTWORLD); enablePlugins(PluginLoadOrder.POSTWORLD);
@@ -1058,13 +1075,8 @@ public final class CraftServer implements Server { @@ -1326,7 +1343,7 @@ public final class CraftServer implements Server {
return count;
}
+ // Spigot start
public OfflinePlayer getOfflinePlayer(String name) {
- return getOfflinePlayer(name, true);
- }
-
- public OfflinePlayer getOfflinePlayer(String name, boolean search) {
- Validate.notNull(name, "Name cannot be null");
-
OfflinePlayer result = getPlayerExact(name);
String lname = name.toLowerCase();
@@ -1072,17 +1084,7 @@ public final class CraftServer implements Server {
result = offlinePlayers.get(lname);
if (result == null) {
- if (search) {
- WorldNBTStorage storage = (WorldNBTStorage) console.worlds.get(0).getDataManager();
- for (String dat : storage.getPlayerDir().list(new DatFileFilter())) {
- String datName = dat.substring(0, dat.length() - 4);
- if (datName.equalsIgnoreCase(name)) {
- name = datName;
- break;
- }
- }
- }
-
+ // Spigot end
result = new CraftOfflinePlayer(this, name);
offlinePlayers.put(lname, result);
}
@@ -1220,7 +1222,7 @@ public final class CraftServer implements Server {
Set<OfflinePlayer> players = new HashSet<OfflinePlayer>();
for (String file : files) {
- players.add(getOfflinePlayer(file.substring(0, file.length() - 4), false));
+ players.add(getOfflinePlayer(file.substring(0, file.length() - 4))); // Spigot
}
players.addAll(Arrays.asList(getOnlinePlayers()));
@@ -1326,7 +1328,7 @@ public final class CraftServer implements Server {
public List<String> tabCompleteCommand(Player player, String message) { public List<String> tabCompleteCommand(Player player, String message) {
List<String> completions = null; List<String> completions = null;
try { try {