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.
This commit is contained in:
Aikar
2018-03-22 23:32:55 -04:00
parent e15167251b
commit cff8ae9644
6 changed files with 14 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
From dc84dd3d43671fc1197e4e976eaca94cbc1e112f Mon Sep 17 00:00:00 2001
From 8f9e12c59e5c19ba02c4baad5a2d5575a07a3ffc Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 19 Jan 2018 00:36:25 -0500
Subject: [PATCH] Add SkullMeta.setPlayerProfile API
@@ -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
@@ -2,6 +2,8 @@ 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
+

View File

@@ -1,4 +1,4 @@
From be13b11e1cb79084ab4d0b400ab6c013a0357fa7 Mon Sep 17 00:00:00 2001
From 26a88cddba5d4b477a501c983fead50ad3c9e5df Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Wed, 11 Oct 2017 15:56:26 +0200
Subject: [PATCH] Implement extended PaperServerListPingEvent
@@ -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 +1,112 @@
@@ -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
@@ -768,7 +768,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs