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 eccfbfe377
commit b9ab5132c3
3 changed files with 25 additions and 5 deletions

View file

@ -44,6 +44,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
minecraftserver.getGameProfileRepository().findProfilesByNames(astring, Agent.MINECRAFT, profilelookupcallback);
} else {
String[] astring1 = astring;
diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/players/UserCache.java
+++ b/src/main/java/net/minecraft/server/players/UserCache.java
@@ -0,0 +0,0 @@ public class UserCache {
}
};
+ if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode()) // Paper - only run in online mode - 100 COL
gameprofilerepository.findProfilesByNames(new String[]{s}, Agent.MINECRAFT, profilelookupcallback);
GameProfile gameprofile = (GameProfile) atomicreference.get();
@@ -0,0 +0,0 @@ public class UserCache {
}
private static boolean c() {
- return UserCache.b;
+ return com.destroystokyo.paper.PaperConfig.isProxyOnlineMode(); // Paper
}
public synchronized void a(GameProfile gameprofile) { // Paper - synchronize
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java

View file

@ -150,7 +150,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @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..00000000000000000000000000000000
+
+ 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();
@ -486,7 +486,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final GameProfileRepository e;
private final Gson f = (new GsonBuilder()).create();
@@ -0,0 +0,0 @@ public class UserCache {
return UserCache.b;
return com.destroystokyo.paper.PaperConfig.isProxyOnlineMode(); // Paper
}
+ public void saveProfile(GameProfile gameprofile) { a(gameprofile); } // Paper - OBFHELPER

View file

@ -25,8 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ GameProfile profile;
+ // Only fetch an online UUID in online mode
+ if (net.minecraft.server.MinecraftServer.getServer().getOnlineMode()
+ || (org.spigotmc.SpigotConfig.bungee && com.destroystokyo.paper.PaperConfig.bungeeOnlineMode)) {
+ if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode()) {
+ profile = console.getUserCache().getProfile( name );
+ } else {
+ // Make an OfflinePlayer using an offline mode UUID since the name has no profile