Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void saveInventory(List<ItemStack> items){
- try {
- FileOutputStream fos = new FileOutputStream(new File(dir));
- BukkitObjectOutputStream boos = new BukkitObjectOutputStream(fos);
- boos.writeObject(items);
- boos.close();
- } catch (IOException ioexception) {
- ioexception.printStackTrace();
- }
- }
- @SuppressWarnings("unchecked")
- public List<ItemStack> loadInventory(){
- List<ItemStack> loadedList = null;
- try {
- FileInputStream fis = new FileInputStream(new File(dir));
- BukkitObjectInputStream bois = new BukkitObjectInputStream(fis);
- loadedList = (List<ItemStack>) bois.readObject();
- bois.close();
- } catch (IOException ioexception) {
- ioexception.printStackTrace();
- return null;
- } catch (ClassNotFoundException classNotFoundException) {
- classNotFoundException.printStackTrace();
- return null;
- }
- return loadedList;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement