From e5f214ef92e3ca5cfffbaf6d0868a722c7470b96 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 28 Jun 2020 22:11:02 -0400 Subject: [PATCH] Fix Player Profile textures being duplicated - Fixes #3667 --- .../Basic-PlayerProfile-API.patch | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch index 18faa03183..f5f10d5f7d 100644 --- a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch +++ b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch @@ -220,6 +220,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + for (Property property : sourceProperties.values()) { ++ targetProperties.removeAll(property.getName()); + targetProperties.put(property.getName(), property); + } + } @@ -466,6 +467,48 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public MinecraftSessionService getMinecraftSessionService() { return this.minecraftSessionService; } +diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/TileEntitySkull.java ++++ b/src/main/java/net/minecraft/server/TileEntitySkull.java +@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa + private void f() { + // Spigot start + GameProfile profile = this.gameProfile; ++ if (profile != null && profile.isComplete() && profile.getProperties().containsKey("textures")) return; // Paper + b(profile, new Predicate() { + + @Override +@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa + } else if (MinecraftServer.getServer() == null) { + callback.apply(gameprofile); + } else { +- GameProfile profile = skinCache.getIfPresent(gameprofile.getName().toLowerCase(java.util.Locale.ROOT)); ++ // Paper start ++ com.destroystokyo.paper.profile.CraftPlayerProfile paperProfile = new com.destroystokyo.paper.profile.CraftPlayerProfile(gameprofile); ++ if (sync) { ++ // might complete by cache, but if not, go ahead and do it now, avoid the code below ++ paperProfile.complete(true, true); ++ } else { ++ paperProfile.completeFromCache(false, true); ++ } ++ GameProfile profile = paperProfile.getGameProfile(); ++ // Paper end + if (profile != null && Iterables.getFirst(profile.getProperties().get("textures"), (Object) null) != null) { + callback.apply(profile); + +@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa + Callable callable = new Callable() { + @Override + public GameProfile call() { +- final GameProfile profile = skinCache.getUnchecked(gameprofile.getName().toLowerCase(java.util.Locale.ROOT)); ++ // Paper start ++ paperProfile.complete(true, true); ++ final GameProfile profile = paperProfile.getGameProfile(); ++ // Paper end + MinecraftServer.getServer().processQueue.add(new Runnable() { + @Override + public void run() { diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/UserCache.java