aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZach Brown <[email protected]>2018-11-05 21:51:04 -0500
committerZach Brown <[email protected]>2018-11-05 21:53:33 -0500
commit67787d388c887020c8053e6626138ad7e984cc8f (patch)
treefd00ce257f84e4b874070ba09186f2282db363a0
parent857123a6538237efff9a7dc6a3cbd7588d2ede02 (diff)
downloadPaper-67787d388c887020c8053e6626138ad7e984cc8f.tar.gz
Paper-67787d388c887020c8053e6626138ad7e984cc8f.zip
Fix server icon encoding to show on newer clients
The base64 encoding method for server favicons in 1.12 puts newlines in the encoded string. The 1.13 client and server pair fixed this issue and no longer consider it valid. Luckily the 1.12.2 client will parse the correct encoding just fine as well. This fixes the encoding so that the server icon will display properly on both 1.12.2 clients as well as newer clients. Shout out to ViaVersion whose contributors noticed this some time ago.
-rw-r--r--Spigot-Server-Patches/0368-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0368-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch b/Spigot-Server-Patches/0368-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch
new file mode 100644
index 0000000000..2752544c77
--- /dev/null
+++ b/Spigot-Server-Patches/0368-Fix-server-icon-encoding-to-show-properly-on-1.13-cl.patch
@@ -0,0 +1,36 @@
+From 4bca90c7e6140df3eedf5527f28d9081ea048508 Mon Sep 17 00:00:00 2001
+From: Zach Brown <[email protected]>
+Date: Mon, 5 Nov 2018 21:50:13 -0500
+Subject: [PATCH] Fix server icon encoding to show properly on 1.13 clients as
+ well
+
+
+diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
+index e0546e3dd..3b982f990 100644
+--- a/src/main/java/net/minecraft/server/MinecraftServer.java
++++ b/src/main/java/net/minecraft/server/MinecraftServer.java
+@@ -735,7 +735,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
+ ImageIO.write(bufferedimage, "PNG", new ByteBufOutputStream(bytebuf));
+ /*ByteBuf */ bytebuf1 = Base64.encode(bytebuf); // Paper - cleanup favicon bytebuf
+
+- serverping.setFavicon("data:image/png;base64," + bytebuf1.toString(StandardCharsets.UTF_8));
++ serverping.setFavicon("data:image/png;base64," + bytebuf1.toString(StandardCharsets.UTF_8).replace("\n", "")); // Paper - Fix encoding for 1.13+ clients, still compat w/ 1.12 clients
+ } catch (Exception exception) {
+ MinecraftServer.LOGGER.error("Couldn\'t load server icon", exception);
+ } finally {
+diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+index 9fe555986..7c82e18b9 100644
+--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+@@ -1778,7 +1778,7 @@ public final class CraftServer implements Server {
+ ImageIO.write(image, "PNG", new ByteBufOutputStream(bytebuf));
+ ByteBuf bytebuf1 = Base64.encode(bytebuf);
+
+- return new CraftIconCache("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
++ return new CraftIconCache("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8).replace("\n", "")); // Paper - Fix encoding for 1.13+ clients, still compat w/ 1.12 clients
+ }
+
+ @Override
+--
+2.19.1
+