Skip to content

Commit 4744b98

Browse files
committed
use Base64 instead of Base64Coder, adds support for newer versions
1 parent 642d0a1 commit 4744b98

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/dev/noah/perplayerkit/util/Serializer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
import org.bukkit.inventory.ItemStack;
2222
import org.bukkit.util.io.BukkitObjectInputStream;
2323
import org.bukkit.util.io.BukkitObjectOutputStream;
24-
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
2524

2625
import java.io.ByteArrayInputStream;
2726
import java.io.ByteArrayOutputStream;
2827
import java.io.IOException;
28+
import java.util.Base64;
2929

3030
public class Serializer {
3131

@@ -52,7 +52,7 @@ public static String itemStackArrayToBase64(ItemStack[] items) throws IllegalSta
5252

5353
// Serialize that array
5454
dataOutput.close();
55-
return Base64Coder.encodeLines(outputStream.toByteArray());
55+
return Base64.getMimeEncoder().encodeToString(outputStream.toByteArray());
5656
} catch (Exception e) {
5757
throw new IllegalStateException("Unable to save item stacks.", e);
5858
}
@@ -69,7 +69,7 @@ public static String itemStackArrayToBase64(ItemStack[] items) throws IllegalSta
6969
*/
7070
public static ItemStack[] itemStackArrayFromBase64(String data) throws IOException {
7171
try {
72-
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
72+
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64.getMimeDecoder().decode(data));
7373
BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);
7474
ItemStack[] items = new ItemStack[dataInput.readInt()];
7575

0 commit comments

Comments
 (0)