Fix username connecting with no texture being overwritten by usercache (#4970)

This commit is contained in:
Camotoy 2021-03-01 16:06:05 -05:00 committed by GitHub
parent df4c68b669
commit 06900aef5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View file

@ -46,4 +46,5 @@ ysl3000 <yannicklamprecht@live.de>
KennyTV <jahnke.nassim@gmail.com> KennyTV <jahnke.nassim@gmail.com>
Machine_Maker <machine@machinemaker.me> Machine_Maker <machine@machinemaker.me>
Ivan Pekov <ivan@mrivanplays.com> Ivan Pekov <ivan@mrivanplays.com>
Camotoy <20743703+Camotoy@users.noreply.github.com>
``` ```

View file

@ -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 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 new file mode 100644
index 0000000000000000000000000000000000000000..2751ce7f1556da07ef853807a588f096adf6ef7f index 0000000000000000000000000000000000000000..6ae316109c8e35fbb6b0aebdee3075beb1445f1b
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java +++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
@@ -0,0 +1,297 @@ @@ -0,0 +1,301 @@
+package com.destroystokyo.paper.profile; +package com.destroystokyo.paper.profile;
+ +
+import com.destroystokyo.paper.PaperConfig; +import com.destroystokyo.paper.PaperConfig;
@ -179,9 +179,13 @@ index 0000000000000000000000000000000000000000..2751ce7f1556da07ef853807a588f096
+ if ((profile.getName() == null || !hasTextures()) && profile.getId() != null) { + if ((profile.getName() == null || !hasTextures()) && profile.getId() != null) {
+ GameProfile profile = userCache.getProfile(this.profile.getId()); + GameProfile profile = userCache.getProfile(this.profile.getId());
+ if (profile != null) { + if (profile != null) {
+ 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 + // if old has it, assume its newer, so overwrite, else use cached if it was set and ours wasn't
+ copyProfileProperties(this.profile, profile); + copyProfileProperties(this.profile, profile);
+ this.profile = profile; + this.profile = profile;
+ } else {
+ copyProfileProperties(profile, this.profile);
+ }
+ } + }
+ } + }
+ return this.profile.isComplete(); + return this.profile.isComplete();