mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-04 02:01:44 +01:00
SPIGOT-4008: Fix server-icon loading
This commit is contained in:
parent
00bba6e86f
commit
ee3c26688e
1 changed files with 5 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue