diff options
author | md_5 <git@md-5.net> | 2018-07-16 10:08:07 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-07-16 10:08:07 +1000 |
commit | ee3c26688e32e8dd15b30eaa8d46ada64f13c865 (patch) | |
tree | 2e43d3ce8b11a5803e8ce8772f19ee152f7caaa8 | |
parent | 00bba6e86f4d102a3f806b7b940b96fc5ed6866c (diff) | |
download | craftbukkit-ee3c26688e32e8dd15b30eaa8d46ada64f13c865.tar craftbukkit-ee3c26688e32e8dd15b30eaa8d46ada64f13c865.tar.gz craftbukkit-ee3c26688e32e8dd15b30eaa8d46ada64f13c865.tar.lz craftbukkit-ee3c26688e32e8dd15b30eaa8d46ada64f13c865.tar.xz craftbukkit-ee3c26688e32e8dd15b30eaa8d46ada64f13c865.zip |
SPIGOT-4008: Fix server-icon loading
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftServer.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 91c239a1..93886407 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -133,7 +133,9 @@ import com.mojang.brigadier.tree.LiteralCommandNode; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufOutputStream; import io.netty.buffer.Unpooled; -import io.netty.handler.codec.base64.Base64; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.Base64; import java.util.HashMap; import jline.console.ConsoleReader; import org.bukkit.Keyed; @@ -1667,9 +1669,9 @@ public final class CraftServer implements Server { Validate.isTrue(image.getWidth() == 64, "Must be 64 pixels wide"); Validate.isTrue(image.getHeight() == 64, "Must be 64 pixels high"); ImageIO.write(image, "PNG", new ByteBufOutputStream(bytebuf)); - ByteBuf bytebuf1 = Base64.encode(bytebuf); + ByteBuffer bytebuffer = Base64.getEncoder().encode(bytebuf.nioBuffer()); - return new CraftIconCache("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8)); + return new CraftIconCache("data:image/png;base64," + StandardCharsets.UTF_8.decode(bytebuffer)); } @Override |