From 3c6db79e462620c50e5c70dbb628f0335f5fd028 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 22 Mar 2018 23:32:55 -0400 Subject: [PATCH] Use copies for PlayerProfile in PaperServerList and SkullMeta Don't want to risk mutating players properties in server list (unlikely, but lets be proper) and Skull also has a setter API, so that should be used too. --- .../Implement-deprecated-player-sample-API.patch | 2 +- .../Add-SkullMeta.setPlayerProfile-API.patch | 4 ++-- .../Implement-extended-PaperServerListPingEvent.patch | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Spigot-API-Patches/Implement-deprecated-player-sample-API.patch b/Spigot-API-Patches/Implement-deprecated-player-sample-API.patch index 55a3cbd68a..fd2ce11d0a 100644 --- a/Spigot-API-Patches/Implement-deprecated-player-sample-API.patch +++ b/Spigot-API-Patches/Implement-deprecated-player-sample-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement deprecated player sample API diff --git a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java -index a6576f99..41899698 100644 +index dd1deafd..32cf9f01 100644 --- a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java @@ -0,0 +0,0 @@ import static java.util.Objects.requireNonNull; diff --git a/Spigot-Server-Patches/Add-SkullMeta.setPlayerProfile-API.patch b/Spigot-Server-Patches/Add-SkullMeta.setPlayerProfile-API.patch index b455145ff9..14887a0fa9 100644 --- a/Spigot-Server-Patches/Add-SkullMeta.setPlayerProfile-API.patch +++ b/Spigot-Server-Patches/Add-SkullMeta.setPlayerProfile-API.patch @@ -7,7 +7,7 @@ This allows you to create already filled textures on Skulls to avoid texture loo which commonly cause rate limit issues with Mojang API diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -index e2ea49cd9..4855307b9 100644 +index e2ea49cd9..dbc083351 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java @@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.inventory; @@ -41,7 +41,7 @@ index e2ea49cd9..4855307b9 100644 + @Nullable + @Override + public PlayerProfile getPlayerProfile() { -+ return profile != null ? CraftPlayerProfile.asBukkitMirror(profile) : null; ++ return profile != null ? CraftPlayerProfile.asBukkitCopy(profile) : null; + } + // Paper end + diff --git a/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch b/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch index e3dc99026d..83b3c7b758 100644 --- a/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch +++ b/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch @@ -60,7 +60,7 @@ index 000000000..a2a409e63 +} diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java new file mode 100644 -index 000000000..33dd196fb +index 000000000..350410527 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java @@ -0,0 +0,0 @@ @@ -101,7 +101,7 @@ index 000000000..33dd196fb + + if (this.originalSample != null) { + for (GameProfile profile : this.originalSample) { -+ sample.add(CraftPlayerProfile.asBukkitMirror(profile)); ++ sample.add(CraftPlayerProfile.asBukkitCopy(profile)); + } + this.originalSample = null; + } @@ -177,7 +177,7 @@ index 000000000..33dd196fb + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e8c72db96..9da09d53b 100644 +index 579f0ba0d..99cfe1ae5 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs