Fix don't lookup profiles for blank names patch

This commit is contained in:
Shane Freeder 2022-06-09 22:37:26 +01:00
parent 09c9215b85
commit ad51c406d5
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
5 changed files with 24 additions and 23 deletions

View File

@ -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));

View File

@ -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() {

View File

@ -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();
}

View File

@ -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<Optional<GameProfile>> consumer) {
@@ -202,6 +217,7 @@ public class GameProfileCache {
@@ -203,6 +218,7 @@ public class GameProfileCache {
}
public Optional<GameProfile> 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<GameProfileCache.GameProfileInfo> getTopMRUProfiles(int limit) {

View File

@ -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);