Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.io.BukkitObjectInputStream;
import org.bukkit.util.io.BukkitObjectOutputStream;
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Base64;

public class ItemSerializer {
public static String toBase64(ItemStack itemStack) throws IllegalStateException {
Expand All @@ -20,7 +20,7 @@ public static String toBase64(ItemStack itemStack) throws IllegalStateException

// Serialize that array
dataOutput.close();
return Base64Coder.encodeLines(outputStream.toByteArray());
return Base64.getEncoder().encodeToString(outputStream.toByteArray());
} catch (Exception e) {
ValhallaTrinkets.getPlugin().getServer().getLogger().severe("Unable to save itemstack from encoded data");
throw new IllegalStateException("Unable to save item stacks.", e);
Expand All @@ -29,7 +29,7 @@ public static String toBase64(ItemStack itemStack) throws IllegalStateException

public static ItemStack itemStackFromBase64(String data) {
try {
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64.getMimeDecoder().decode(data));
BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);

ItemStack i = (ItemStack) dataInput.readObject();
Expand Down