1.21.5
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: MiniDigger | Martin <admin@minidigger.dev> Co-authored-by: Nassim Jahnke <nassim@njahnke.dev> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com> Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/players/GameProfileCache.java
|
||||
+++ b/net/minecraft/server/players/GameProfileCache.java
|
||||
@@ -56,6 +_,10 @@
|
||||
@@ -54,6 +_,10 @@
|
||||
private final AtomicLong operationCount = new AtomicLong();
|
||||
@Nullable
|
||||
private Executor executor;
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
public GameProfileCache(GameProfileRepository profileRepository, File file) {
|
||||
this.profileRepository = profileRepository;
|
||||
@@ -64,10 +_,12 @@
|
||||
@@ -62,17 +_,21 @@
|
||||
}
|
||||
|
||||
private void safeAdd(GameProfileCache.GameProfileInfo profile) {
|
||||
@@ -24,16 +24,17 @@
|
||||
}
|
||||
|
||||
private static Optional<GameProfile> lookupGameProfile(GameProfileRepository profileRepo, String name) {
|
||||
@@ -86,6 +_,8 @@
|
||||
atomicReference.set(null);
|
||||
}
|
||||
};
|
||||
+ 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 - Add setting for proxy online mode status
|
||||
profileRepo.findProfilesByNames(new String[]{name}, profileLookupCallback);
|
||||
GameProfile gameProfile = atomicReference.get();
|
||||
return gameProfile != null ? Optional.of(gameProfile) : createUnknownProfile(name);
|
||||
@@ -101,7 +_,7 @@
|
||||
if (!StringUtil.isValidPlayerName(name)) {
|
||||
return createUnknownProfile(name);
|
||||
} else {
|
||||
- Optional<GameProfile> optional = profileRepo.findProfileByName(name);
|
||||
+ final boolean shouldLookup = !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 - Add setting for proxy online mode status
|
||||
+ Optional<GameProfile> optional = shouldLookup ? profileRepo.findProfileByName(name) : Optional.empty(); // Paper - Don't lookup a profile with a blank name
|
||||
return optional.isEmpty() ? createUnknownProfile(name) : optional;
|
||||
}
|
||||
}
|
||||
@@ -86,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static boolean usesAuthentication() {
|
||||
@@ -42,7 +43,7 @@
|
||||
}
|
||||
|
||||
public void add(GameProfile gameProfile) {
|
||||
@@ -111,15 +_,29 @@
|
||||
@@ -96,15 +_,29 @@
|
||||
Date time = instance.getTime();
|
||||
GameProfileCache.GameProfileInfo gameProfileInfo = new GameProfileCache.GameProfileInfo(gameProfile, time);
|
||||
this.safeAdd(gameProfileInfo);
|
||||
@@ -73,7 +74,7 @@
|
||||
GameProfileCache.GameProfileInfo gameProfileInfo = this.profilesByName.get(string);
|
||||
boolean flag = false;
|
||||
if (gameProfileInfo != null && new Date().getTime() >= gameProfileInfo.expirationDate.getTime()) {
|
||||
@@ -133,19 +_,24 @@
|
||||
@@ -118,19 +_,24 @@
|
||||
if (gameProfileInfo != null) {
|
||||
gameProfileInfo.setLastAccess(this.getNextOperation());
|
||||
optional = Optional.of(gameProfileInfo.getProfile());
|
||||
@@ -101,7 +102,7 @@
|
||||
}
|
||||
|
||||
public CompletableFuture<Optional<GameProfile>> getAsync(String name) {
|
||||
@@ -157,7 +_,7 @@
|
||||
@@ -142,7 +_,7 @@
|
||||
return completableFuture;
|
||||
} else {
|
||||
CompletableFuture<Optional<GameProfile>> completableFuture1 = CompletableFuture.<Optional<GameProfile>>supplyAsync(
|
||||
@@ -110,7 +111,7 @@
|
||||
)
|
||||
.whenCompleteAsync((gameProfile, exception) -> this.requests.remove(name), this.executor);
|
||||
this.requests.put(name, completableFuture1);
|
||||
@@ -167,6 +_,7 @@
|
||||
@@ -152,6 +_,7 @@
|
||||
}
|
||||
|
||||
public Optional<GameProfile> get(UUID uuid) {
|
||||
@@ -118,7 +119,7 @@
|
||||
GameProfileCache.GameProfileInfo gameProfileInfo = this.profilesByUUID.get(uuid);
|
||||
if (gameProfileInfo == null) {
|
||||
return Optional.empty();
|
||||
@@ -174,6 +_,7 @@
|
||||
@@ -159,6 +_,7 @@
|
||||
gameProfileInfo.setLastAccess(this.getNextOperation());
|
||||
return Optional.of(gameProfileInfo.getProfile());
|
||||
}
|
||||
@@ -126,7 +127,7 @@
|
||||
}
|
||||
|
||||
public void setExecutor(Executor exectutor) {
|
||||
@@ -206,6 +_,11 @@
|
||||
@@ -191,6 +_,11 @@
|
||||
|
||||
return (List<GameProfileCache.GameProfileInfo>)var9;
|
||||
} catch (FileNotFoundException var7) {
|
||||
@@ -138,7 +139,7 @@
|
||||
} catch (JsonParseException | IOException var8) {
|
||||
LOGGER.warn("Failed to load profile cache {}", this.file, var8);
|
||||
}
|
||||
@@ -213,24 +_,45 @@
|
||||
@@ -198,24 +_,45 @@
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user