Skip to content

Commit 048b080

Browse files
committed
fix base64 apply
1 parent 592d6f3 commit 048b080

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/me/hsgamer/bettergui/modifier/SkullModifier.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.lang.reflect.Field;
2323
import java.lang.reflect.Method;
2424
import java.net.URL;
25+
import java.nio.charset.StandardCharsets;
2526
import java.util.*;
2627
import java.util.concurrent.ConcurrentHashMap;
2728
import java.util.regex.Pattern;
@@ -212,7 +213,7 @@ public void setSkullByURL(SkullMeta meta, URL url) {
212213
@Override
213214
public void setSkullByBase64(SkullMeta meta, byte[] base64) {
214215
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "");
215-
gameProfile.getProperties().put("textures", new Property("textures", Base64.getEncoder().encodeToString(base64)));
216+
gameProfile.getProperties().put("textures", new Property("textures", new String(base64, StandardCharsets.UTF_8)));
216217
setSkullByGameProfile(meta, gameProfile);
217218
}
218219

@@ -270,7 +271,7 @@ public void setSkullByURL(SkullMeta meta, URL url) {
270271
@Override
271272
public void setSkullByBase64(SkullMeta meta, byte[] base64) {
272273
try {
273-
String decoded = new String(Base64.getDecoder().decode(base64));
274+
String decoded = new String(base64, StandardCharsets.UTF_8);
274275
JsonObject json = new Gson().fromJson(decoded, JsonObject.class);
275276
String url = json.getAsJsonObject("textures").getAsJsonObject("SKIN").get("url").getAsString();
276277
setSkullByURL(meta, url);

0 commit comments

Comments
 (0)