From 06900aef5e9b0bc6916e85ff4497472b296b481e Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 1 Mar 2021 16:06:05 -0500 Subject: [PATCH] Fix username connecting with no texture being overwritten by usercache (#4970) --- LICENSE.md | 1 + .../0152-Basic-PlayerProfile-API.patch | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 44ee0cf99..14583a062 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -46,4 +46,5 @@ ysl3000 KennyTV Machine_Maker Ivan Pekov +Camotoy <20743703+Camotoy@users.noreply.github.com> ``` diff --git a/Spigot-Server-Patches/0152-Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/0152-Basic-PlayerProfile-API.patch index 4c636d048..303e6b7c6 100644 --- a/Spigot-Server-Patches/0152-Basic-PlayerProfile-API.patch +++ b/Spigot-Server-Patches/0152-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..2751ce7f1556da07ef853807a588f096adf6ef7f +index 0000000000000000000000000000000000000000..6ae316109c8e35fbb6b0aebdee3075beb1445f1b --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java -@@ -0,0 +1,297 @@ +@@ -0,0 +1,301 @@ +package com.destroystokyo.paper.profile; + +import com.destroystokyo.paper.PaperConfig; @@ -179,9 +179,13 @@ index 0000000000000000000000000000000000000000..2751ce7f1556da07ef853807a588f096 + if ((profile.getName() == null || !hasTextures()) && profile.getId() != null) { + GameProfile profile = userCache.getProfile(this.profile.getId()); + if (profile != null) { -+ // if old has it, assume its newer, so overwrite, else use cached if it was set and ours wasn't -+ copyProfileProperties(this.profile, profile); -+ this.profile = profile; ++ if (this.profile.getName() == null) { ++ // if old has it, assume its newer, so overwrite, else use cached if it was set and ours wasn't ++ copyProfileProperties(this.profile, profile); ++ this.profile = profile; ++ } else { ++ copyProfileProperties(profile, this.profile); ++ } + } + } + return this.profile.isComplete();