Initial commit

This commit is contained in:
Scifi9902
2026-10-12 13:57:05 -03:00
commit 4bde3b176a
2576 changed files with 212659 additions and 0 deletions
@@ -0,0 +1,30 @@
package net.crankedpvp.monthlycrates.utils;
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;
public class Base64 {
public static ItemStack deserialize(String base64) throws IOException, ClassNotFoundException {
byte[] data = Base64Coder.decodeLines(base64);
ByteArrayInputStream bytesIn = new ByteArrayInputStream(data);
BukkitObjectInputStream in = new BukkitObjectInputStream(bytesIn);
ItemStack itemStack = (ItemStack) in.readObject();
in.close();
return itemStack;
}
public static String serialize(ItemStack itemStack) throws IOException {
ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
BukkitObjectOutputStream out = new BukkitObjectOutputStream(bytesOut);
out.writeObject(itemStack);
out.flush();
out.close();
return Base64Coder.encodeLines(bytesOut.toByteArray());
}
}