mirror of
https://github.com/PaperMC/Paper.git
synced 2025-11-08 10:56:44 +00:00
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Pedro <3602279+Doc94@users.noreply.github.com>
27 lines
1.5 KiB
Diff
27 lines
1.5 KiB
Diff
--- a/net/minecraft/server/players/ProfileResolver.java
|
|
+++ b/net/minecraft/server/players/ProfileResolver.java
|
|
@@ -25,7 +_,7 @@
|
|
private final LoadingCache<String, Optional<GameProfile>> profileCacheByName;
|
|
final LoadingCache<UUID, Optional<GameProfile>> profileCacheById;
|
|
|
|
- public Cached(final MinecraftSessionService sessionService, final UserNameToIdResolver resolver) {
|
|
+ public Cached(final MinecraftSessionService sessionService, final UserNameToIdResolver resolver, final io.papermc.paper.profile.PaperFilledProfileCache paperCache) { // Paper - add paperCache
|
|
this.profileCacheById = CacheBuilder.newBuilder()
|
|
.expireAfterAccess(Duration.ofMinutes(10L))
|
|
.maximumSize(256L)
|
|
@@ -33,7 +_,13 @@
|
|
@Override
|
|
public Optional<GameProfile> load(UUID id) {
|
|
ProfileResult profileResult = sessionService.fetchProfile(id, true);
|
|
- return Optional.ofNullable(profileResult).map(ProfileResult::profile);
|
|
+ // Paper start - update paper cache
|
|
+ return Optional.ofNullable(profileResult).map(ProfileResult::profile)
|
|
+ .map(profile -> {
|
|
+ paperCache.add(profile);
|
|
+ return profile;
|
|
+ });
|
|
+ // Paper end - update paper cache
|
|
}
|
|
});
|
|
this.profileCacheByName = CacheBuilder.newBuilder()
|