aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAikar <[email protected]>2020-06-28 22:11:02 -0400
committerAikar <[email protected]>2020-06-28 22:11:51 -0400
commit49491f32d9774086c4b89f812812e54cb12b2140 (patch)
tree26194820a66c97b1c3cfb7e283343386d8647e5c
parent3fc9899921e739e4b6365ce5c031a7a06a89014b (diff)
downloadPaper-49491f32d9774086c4b89f812812e54cb12b2140.tar.gz
Paper-49491f32d9774086c4b89f812812e54cb12b2140.zip
Fix Player Profile textures being duplicated - Fixes #3667
-rw-r--r--Spigot-Server-Patches/0154-Basic-PlayerProfile-API.patch47
1 files changed, 45 insertions, 2 deletions
diff --git a/Spigot-Server-Patches/0154-Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/0154-Basic-PlayerProfile-API.patch
index 65d31b903a..e4374b0500 100644
--- a/Spigot-Server-Patches/0154-Basic-PlayerProfile-API.patch
+++ b/Spigot-Server-Patches/0154-Basic-PlayerProfile-API.patch
@@ -7,10 +7,10 @@ Establishes base extension of profile systems for future edits too
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
new file mode 100644
-index 0000000000000000000000000000000000000000..d73de9eb89c4e3a748907f2da21a3072cc6b7f41
+index 0000000000000000000000000000000000000000..293b73f4747f48dbf8b6a8453d3fc777de11588d
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
-@@ -0,0 +1,296 @@
+@@ -0,0 +1,297 @@
+package com.destroystokyo.paper.profile;
+
+import com.destroystokyo.paper.PaperConfig;
@@ -220,6 +220,7 @@ index 0000000000000000000000000000000000000000..d73de9eb89c4e3a748907f2da21a3072
+ }
+
+ for (Property property : sourceProperties.values()) {
++ targetProperties.removeAll(property.getName());
+ targetProperties.put(property.getName(), property);
+ }
+ }
@@ -466,6 +467,48 @@ index ed32242bd169e9f28607942aa31aa48a5799b215..54f80cb8e1b771f2a493543e04f8bc83
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 177cceb77f8783fe93ba7e4342de9c589f155c1b..83faa9dc5f74df4609cab34a66e4feed12990463 100644
+--- a/src/main/java/net/minecraft/server/TileEntitySkull.java
++++ b/src/main/java/net/minecraft/server/TileEntitySkull.java
+@@ -158,6 +158,7 @@ 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<GameProfile>() {
+
+ @Override
+@@ -178,7 +179,16 @@ 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);
+
+@@ -187,7 +197,10 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
+ Callable<GameProfile> callable = new Callable<GameProfile>() {
+ @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 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c12ea75272 100644
--- a/src/main/java/net/minecraft/server/UserCache.java