mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
Do not copy profile data if profiles are the same (#10259)
This commit is contained in:
parent
41ffa0cf8c
commit
88419b2075
@ -16,10 +16,10 @@ public org.bukkit.craftbukkit.profile.CraftPlayerProfile setProperty(Ljava/lang/
|
|||||||
|
|
||||||
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..daa157eaa021d039f9a092bea0b78f7c1f746e3b
|
index 0000000000000000000000000000000000000000..68c99e29450e318d2b6eb83099e3e4012b6f0c01
|
||||||
--- /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,409 @@
|
@@ -0,0 +1,412 @@
|
||||||
+package com.destroystokyo.paper.profile;
|
+package com.destroystokyo.paper.profile;
|
||||||
+
|
+
|
||||||
+import com.mojang.authlib.yggdrasil.ProfileResult;
|
+import com.mojang.authlib.yggdrasil.ProfileResult;
|
||||||
@ -236,7 +236,7 @@ index 0000000000000000000000000000000000000000..daa157eaa021d039f9a092bea0b78f7c
|
|||||||
+ // 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 {
|
+ } else if (profile != this.profile) {
|
||||||
+ copyProfileProperties(profile, this.profile);
|
+ copyProfileProperties(profile, this.profile);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
@ -267,6 +267,9 @@ index 0000000000000000000000000000000000000000..daa157eaa021d039f9a092bea0b78f7c
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private static void copyProfileProperties(GameProfile source, GameProfile target, boolean clearTarget) {
|
+ private static void copyProfileProperties(GameProfile source, GameProfile target, boolean clearTarget) {
|
||||||
|
+ if (source == target) {
|
||||||
|
+ throw new IllegalArgumentException("Source and target profiles are the same (" + source + ")");
|
||||||
|
+ }
|
||||||
+ PropertyMap sourceProperties = source.getProperties();
|
+ PropertyMap sourceProperties = source.getProperties();
|
||||||
+ PropertyMap targetProperties = target.getProperties();
|
+ PropertyMap targetProperties = target.getProperties();
|
||||||
+ if (clearTarget) targetProperties.clear();
|
+ if (clearTarget) targetProperties.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user