Advertisement
Tejnox

Untitled

Jan 19th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. public static ItemStack[] itemStackArrayFromBase64(final String data) throws IOException {
  2. try {
  3. if (data.equalsIgnoreCase("")) {
  4. return new ItemStack[0];
  5. }
  6. final ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
  7. final BukkitObjectInputStream dataInput = new BukkitObjectInputStream((InputStream)inputStream);
  8. final ItemStack[] items = new ItemStack[dataInput.readInt()];
  9. for (int i = 0; i < items.length; ++i) {
  10. items[i] = (ItemStack)dataInput.readObject();
  11. }
  12. dataInput.close();
  13. return items;
  14. }
  15. catch (ClassNotFoundException e) {
  16. throw new IOException("Unable to decode class type.", e);
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement