3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-16 03:20:07 +01:00

Fix Player Profile textures being duplicated - Fixes #3667

Dieser Commit ist enthalten in:
Aikar 2020-06-28 22:11:02 -04:00
Ursprung 3fc9899921
Commit 49491f32d9
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE

Datei anzeigen

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