aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorShane Freeder <[email protected]>2024-02-18 13:06:56 +0000
committerShane Freeder <[email protected]>2024-02-18 13:06:56 +0000
commit6668ece28c64f538e450593c3b81994ae31609a8 (patch)
treea9e5ee9dff5bf3001aa5b99c37d7c4190b605991
parent351923d17e3b5f2a2a3ed848c171d7d2b077a55a (diff)
downloadPaper-fix/profile-copying.tar.gz
Paper-fix/profile-copying.zip
Do not copy profile data if profiles are the samefix/profile-copying
-rw-r--r--patches/server/0134-Basic-PlayerProfile-API.patch9
1 files changed, 6 insertions, 3 deletions
diff --git a/patches/server/0134-Basic-PlayerProfile-API.patch b/patches/server/0134-Basic-PlayerProfile-API.patch
index 84b49f7cf9..906038c330 100644
--- a/patches/server/0134-Basic-PlayerProfile-API.patch
+++ b/patches/server/0134-Basic-PlayerProfile-API.patch
@@ -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
new file mode 100644
-index 0000000000000000000000000000000000000000..daa157eaa021d039f9a092bea0b78f7c1f746e3b
+index 0000000000000000000000000000000000000000..68c99e29450e318d2b6eb83099e3e4012b6f0c01
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
-@@ -0,0 +1,409 @@
+@@ -0,0 +1,412 @@
+package com.destroystokyo.paper.profile;
+
+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
+ copyProfileProperties(this.profile, profile);
+ this.profile = profile;
-+ } else {
++ } else if (profile != this.profile) {
+ copyProfileProperties(profile, this.profile);
+ }
+ }
@@ -267,6 +267,9 @@ index 0000000000000000000000000000000000000000..daa157eaa021d039f9a092bea0b78f7c
+ }
+
+ 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 targetProperties = target.getProperties();
+ if (clearTarget) targetProperties.clear();