aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorShane Freeder <[email protected]>2024-03-20 21:47:50 +0000
committerGitHub <[email protected]>2024-03-20 22:47:50 +0100
commit88419b207579533646ab011da886030ea9ea4862 (patch)
tree3ba095d59ddaa3e95ff1f056f5f477368a4a03ef
parent41ffa0cf8c26f6137a0d21d45067fee6d5896edf (diff)
downloadPaper-88419b207579533646ab011da886030ea9ea4862.tar.gz
Paper-88419b207579533646ab011da886030ea9ea4862.zip
Do not copy profile data if profiles are the same (#10259)
-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 a41c0666bc..2a1ca07786 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();