Check Profile Cache for PlayerProfile API

This ensures we look up the name for ID only Profiles

If the profile is in the UserCache, we can get those details quickly

This should avoid some unnecessary round trips.

Additionally, handle profiles for offline mode to use offline UUID's
This commit is contained in:
Aikar
2018-03-22 01:28:22 -04:00
parent feaa8460b1
commit 3341a93c7f
3 changed files with 71 additions and 9 deletions

View File

@@ -23,7 +23,7 @@ index 45d3dbde2..ab7933079 100644
// Spigot end
}
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 487fc11f1..924dc63a4 100644
index 487fc11f1..4fb17a801 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -0,0 +0,0 @@ public class UserCache {
@@ -64,6 +64,15 @@ index 487fc11f1..924dc63a4 100644
ArrayList arraylist = Lists.newArrayList(this.d.keySet());
return (String[]) arraylist.toArray(new String[arraylist.size()]);
}
+ @Nullable public GameProfile getProfile(UUID uuid) { return a(uuid); } // Paper - OBFHELPER
@Nullable
- public GameProfile a(UUID uuid) {
+ public synchronized GameProfile a(UUID uuid) { // Paper - synchronize
UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.e.get(uuid);
return usercache_usercacheentry == null ? null : usercache_usercacheentry.a();
@@ -0,0 +0,0 @@ public class UserCache {
}