Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static ItemStack[] itemStackArrayFromBase64(final String data) throws IOException {
- try {
- if (data.equalsIgnoreCase("")) {
- return new ItemStack[0];
- }
- final ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
- final BukkitObjectInputStream dataInput = new BukkitObjectInputStream((InputStream)inputStream);
- final ItemStack[] items = new ItemStack[dataInput.readInt()];
- for (int i = 0; i < items.length; ++i) {
- items[i] = (ItemStack)dataInput.readObject();
- }
- dataInput.close();
- return items;
- }
- catch (ClassNotFoundException e) {
- throw new IOException("Unable to decode class type.", e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement