fix isProxyOnlineMode coverage, don't lookup UUIDs in offline mode (Fixes #2011)

This commit is contained in:
Shane Freeder
2021-05-05 03:54:42 +01:00
parent 81cc4f9280
commit 453e983e4b
14 changed files with 54 additions and 34 deletions

View File

@@ -7,7 +7,7 @@ Establishes base extension of profile systems for future edits too
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
new file mode 100644
index 0000000000000000000000000000000000000000..040fd0c3fc4bc3a04fe5dff919a41fe9b474708e
index 0000000000000000000000000000000000000000..3d9452892a4077e64f37424052a9e52d76dd7a6d
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
@@ -0,0 +1,301 @@
@@ -150,7 +150,7 @@ index 0000000000000000000000000000000000000000..040fd0c3fc4bc3a04fe5dff919a41fe9
+ @Override
+ public boolean completeFromCache() {
+ MinecraftServer server = MinecraftServer.getServer();
+ return completeFromCache(false, server.getOnlineMode() || (SpigotConfig.bungee && PaperConfig.bungeeOnlineMode));
+ return completeFromCache(false, PaperConfig.isProxyOnlineMode());
+ }
+
+ public boolean completeFromCache(boolean onlineMode) {
@@ -193,7 +193,7 @@ index 0000000000000000000000000000000000000000..040fd0c3fc4bc3a04fe5dff919a41fe9
+
+ public boolean complete(boolean textures) {
+ MinecraftServer server = MinecraftServer.getServer();
+ return complete(textures, server.getOnlineMode() || (SpigotConfig.bungee && PaperConfig.bungeeOnlineMode));
+ return complete(textures, PaperConfig.isProxyOnlineMode());
+ }
+ public boolean complete(boolean textures, boolean onlineMode) {
+ MinecraftServer server = MinecraftServer.getServer();
@@ -473,7 +473,7 @@ index 89db31061fcc3420bc8e668533a4051cdbd12253..191a74bd9b894f9d64d0a55747cb17e0
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName()));
diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java
index 4ad084e7cea3b341ca0dbaa6e853cfc685a555ff..e17927ecc3ad3e27e436082ac94e3772d7311725 100644
index b9f94f957dd5372c8b02d785204690e4ade36a98..692d95c94df85d752a3ddc66e1f2af765565b160 100644
--- a/src/main/java/net/minecraft/server/players/UserCache.java
+++ b/src/main/java/net/minecraft/server/players/UserCache.java
@@ -45,7 +45,7 @@ public class UserCache {
@@ -485,15 +485,15 @@ index 4ad084e7cea3b341ca0dbaa6e853cfc685a555ff..e17927ecc3ad3e27e436082ac94e3772
private final Map<UUID, UserCache.UserCacheEntry> d = Maps.newConcurrentMap();
private final GameProfileRepository e;
private final Gson f = (new GsonBuilder()).create();
@@ -109,6 +109,7 @@ public class UserCache {
return UserCache.b;
@@ -110,6 +110,7 @@ public class UserCache {
return com.destroystokyo.paper.PaperConfig.isProxyOnlineMode(); // Paper
}
+ public void saveProfile(GameProfile gameprofile) { a(gameprofile); } // Paper - OBFHELPER
public synchronized void a(GameProfile gameprofile) { // Paper - synchronize
Calendar calendar = Calendar.getInstance();
@@ -158,6 +159,13 @@ public class UserCache {
@@ -159,6 +160,13 @@ public class UserCache {
return gameprofile;
}
@@ -507,7 +507,7 @@ index 4ad084e7cea3b341ca0dbaa6e853cfc685a555ff..e17927ecc3ad3e27e436082ac94e3772
@Nullable
public GameProfile getProfile(UUID uuid) {
UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(uuid);
@@ -340,7 +348,7 @@ public class UserCache {
@@ -341,7 +349,7 @@ public class UserCache {
static class UserCacheEntry {