From ad51c406d5e94f89788dd9041228d078e27c8065 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 9 Jun 2022 22:37:26 +0100 Subject: [PATCH] Fix don't lookup profiles for blank names patch --- ...game-profiles-that-have-no-UUID-and-no-.patch | 13 ++++++------- ...dd-setting-for-proxy-online-mode-status.patch | 10 ++++++---- .../server/0139-Basic-PlayerProfile-API.patch | 4 ++-- .../0722-Fix-GameProfileCache-concurrency.patch | 16 ++++++++-------- ...mit-profile-lookups-to-worldgen-threads.patch | 4 ++-- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/patches/server/0101-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch b/patches/server/0101-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch index 45952ee427..7c155f0b54 100644 --- a/patches/server/0101-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch +++ b/patches/server/0101-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch @@ -5,15 +5,14 @@ Subject: [PATCH] Don't lookup game profiles that have no UUID and no name diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 717a0d1c1f4df7ebd5f4cdd5e24cabe3fb66bf06..87b7a669ef111b2dc40d152fe6fe4e75ff8ccc98 100644 +index 717a0d1c1f4df7ebd5f4cdd5e24cabe3fb66bf06..d00e8486c145200b2431cf92d7049a6d87d55227 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java -@@ -101,7 +101,7 @@ public class GameProfileCache { +@@ -98,6 +98,7 @@ public class GameProfileCache { + } + }; + ++ if (!org.apache.commons.lang3.StringUtils.isBlank(name)) // Paper - Don't lookup a profile with a blank name) repository.findProfilesByNames(new String[]{name}, Agent.MINECRAFT, profilelookupcallback); GameProfile gameprofile = (GameProfile) atomicreference.get(); -- if (!GameProfileCache.usesAuthentication() && gameprofile == null) { -+ if (!GameProfileCache.usesAuthentication() && gameprofile == null && !org.apache.commons.lang3.StringUtils.isBlank(name)) { // Paper - Don't lookup a profile with a blank name - UUID uuid = UUIDUtil.getOrCreatePlayerUUID(new GameProfile((UUID) null, name)); - - return Optional.of(new GameProfile(uuid, name)); diff --git a/patches/server/0102-Add-setting-for-proxy-online-mode-status.patch b/patches/server/0102-Add-setting-for-proxy-online-mode-status.patch index 709990de52..85f3a3c74c 100644 --- a/patches/server/0102-Add-setting-for-proxy-online-mode-status.patch +++ b/patches/server/0102-Add-setting-for-proxy-online-mode-status.patch @@ -6,18 +6,20 @@ Subject: [PATCH] Add setting for proxy online mode status TODO: Add isProxyOnlineMode check to Metrics diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 87b7a669ef111b2dc40d152fe6fe4e75ff8ccc98..40ddeaea58263820c32a4e901a2e907088eb7b6e 100644 +index d00e8486c145200b2431cf92d7049a6d87d55227..c7edbd12361cfd3dcf1359917d579fae4c3cc8a7 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java -@@ -98,6 +98,7 @@ public class GameProfileCache { +@@ -98,7 +98,8 @@ public class GameProfileCache { } }; -+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) // Paper - only run in online mode - 100 COL +- if (!org.apache.commons.lang3.StringUtils.isBlank(name)) // Paper - Don't lookup a profile with a blank name) ++ if (!org.apache.commons.lang3.StringUtils.isBlank(name) // Paper - Don't lookup a profile with a blank name ++ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()) // Paper - only run in online mode - 100 COL repository.findProfilesByNames(new String[]{name}, Agent.MINECRAFT, profilelookupcallback); GameProfile gameprofile = (GameProfile) atomicreference.get(); -@@ -115,7 +116,7 @@ public class GameProfileCache { +@@ -116,7 +117,7 @@ public class GameProfileCache { } private static boolean usesAuthentication() { diff --git a/patches/server/0139-Basic-PlayerProfile-API.patch b/patches/server/0139-Basic-PlayerProfile-API.patch index 06d46bae87..d294eec6bd 100644 --- a/patches/server/0139-Basic-PlayerProfile-API.patch +++ b/patches/server/0139-Basic-PlayerProfile-API.patch @@ -599,10 +599,10 @@ index a48a12a31a3d09a9373b688dcc093035f8f8a300..97b29bcb20e199c2d02457f8025e67e2 String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 40ddeaea58263820c32a4e901a2e907088eb7b6e..ce3ed1572641599055edf654f20b2a5ecac952dc 100644 +index c7edbd12361cfd3dcf1359917d579fae4c3cc8a7..2a4f8aa6697ed6144440970c9abaf9f6e1a2c2ce 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java -@@ -135,6 +135,17 @@ public class GameProfileCache { +@@ -136,6 +136,17 @@ public class GameProfileCache { return this.operationCount.incrementAndGet(); } diff --git a/patches/server/0722-Fix-GameProfileCache-concurrency.patch b/patches/server/0722-Fix-GameProfileCache-concurrency.patch index 38778e1156..1c8bd06db3 100644 --- a/patches/server/0722-Fix-GameProfileCache-concurrency.patch +++ b/patches/server/0722-Fix-GameProfileCache-concurrency.patch @@ -7,7 +7,7 @@ Separate lookup and state access locks prevent lookups from stalling simple state access/write calls diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index ce3ed1572641599055edf654f20b2a5ecac952dc..b9cdfe42d9a8015b0ddc0cedd9dba4064ce8682d 100644 +index 2a4f8aa6697ed6144440970c9abaf9f6e1a2c2ce..8d86645ef264287d01203afd7bba516e78be5743 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java @@ -62,6 +62,11 @@ public class GameProfileCache { @@ -38,7 +38,7 @@ index ce3ed1572641599055edf654f20b2a5ecac952dc..b9cdfe42d9a8015b0ddc0cedd9dba406 } -@@ -137,17 +144,20 @@ public class GameProfileCache { +@@ -138,17 +145,20 @@ public class GameProfileCache { // Paper start public @Nullable GameProfile getProfileIfCached(String name) { @@ -59,7 +59,7 @@ index ce3ed1572641599055edf654f20b2a5ecac952dc..b9cdfe42d9a8015b0ddc0cedd9dba406 GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1); boolean flag = false; -@@ -163,8 +173,12 @@ public class GameProfileCache { +@@ -164,8 +174,12 @@ public class GameProfileCache { if (usercache_usercacheentry != null) { usercache_usercacheentry.setLastAccess(this.getNextOperation()); optional = Optional.of(usercache_usercacheentry.getProfile()); @@ -72,7 +72,7 @@ index ce3ed1572641599055edf654f20b2a5ecac952dc..b9cdfe42d9a8015b0ddc0cedd9dba406 if (optional.isPresent()) { this.add((GameProfile) optional.get()); flag = false; -@@ -176,6 +190,7 @@ public class GameProfileCache { +@@ -177,6 +191,7 @@ public class GameProfileCache { } return optional; @@ -80,7 +80,7 @@ index ce3ed1572641599055edf654f20b2a5ecac952dc..b9cdfe42d9a8015b0ddc0cedd9dba406 } public void getAsync(String username, Consumer> consumer) { -@@ -202,6 +217,7 @@ public class GameProfileCache { +@@ -203,6 +218,7 @@ public class GameProfileCache { } public Optional get(UUID uuid) { @@ -88,7 +88,7 @@ index ce3ed1572641599055edf654f20b2a5ecac952dc..b9cdfe42d9a8015b0ddc0cedd9dba406 GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByUUID.get(uuid); if (usercache_usercacheentry == null) { -@@ -210,6 +226,7 @@ public class GameProfileCache { +@@ -211,6 +227,7 @@ public class GameProfileCache { usercache_usercacheentry.setLastAccess(this.getNextOperation()); return Optional.of(usercache_usercacheentry.getProfile()); } @@ -96,7 +96,7 @@ index ce3ed1572641599055edf654f20b2a5ecac952dc..b9cdfe42d9a8015b0ddc0cedd9dba406 } public void setExecutor(Executor executor) { -@@ -290,7 +307,7 @@ public class GameProfileCache { +@@ -291,7 +308,7 @@ public class GameProfileCache { JsonArray jsonarray = new JsonArray(); DateFormat dateformat = GameProfileCache.createDateFormat(); @@ -105,7 +105,7 @@ index ce3ed1572641599055edf654f20b2a5ecac952dc..b9cdfe42d9a8015b0ddc0cedd9dba406 jsonarray.add(GameProfileCache.writeGameProfile(usercache_usercacheentry, dateformat)); }); String s = this.gson.toJson(jsonarray); -@@ -331,8 +348,19 @@ public class GameProfileCache { +@@ -332,8 +349,19 @@ public class GameProfileCache { } private Stream getTopMRUProfiles(int limit) { diff --git a/patches/server/0726-Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/0726-Do-not-submit-profile-lookups-to-worldgen-threads.patch index f6222418ce..b4a4b8d8a4 100644 --- a/patches/server/0726-Do-not-submit-profile-lookups-to-worldgen-threads.patch +++ b/patches/server/0726-Do-not-submit-profile-lookups-to-worldgen-threads.patch @@ -37,10 +37,10 @@ index 5f9e3d37c3ba79d26806374d73f87328cebb562d..206c6ce227ba19620185ac835af28d67 public static LongSupplier timeSource = System::nanoTime; public static final Ticker TICKER = new Ticker() { diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index b9cdfe42d9a8015b0ddc0cedd9dba4064ce8682d..25e7d076ce6180c6cbbca89cb905404cd6122892 100644 +index 8d86645ef264287d01203afd7bba516e78be5743..4dff88bdf14675718572e4b3720c0250ce6e730e 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java -@@ -206,7 +206,7 @@ public class GameProfileCache { +@@ -207,7 +207,7 @@ public class GameProfileCache { } else { this.requests.put(username, CompletableFuture.supplyAsync(() -> { return this.get(username);