Archiviert
13
0

Do not copy profile data if profiles are the same (#10259)

Dieser Commit ist enthalten in:
Shane Freeder 2024-03-20 21:47:50 +00:00 committet von GitHub
Ursprung 41ffa0cf8c
Commit 88419b2075
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -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();