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

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