src/info/bytecraft/api/BytecraftPlayer.java
public void saveInventory(String name)
    {
        String inventory = name;
        if (name == null) {
            inventory = this.currentInventory;
        }

        try (IContext ctx = plugin.createContext()) {
            IInventoryDAO dao = ctx.getInventoryDAO();

            int id;
            id = dao.fetchInventory(this, inventory, "main");
            while (id == -1) {
                dao.createInventory(this, inventory, "main");
                id = dao.fetchInventory(this, inventory, "main");
            }

            dao.saveInventory(this, id, "main");

            int id2;
            id2 = dao.fetchInventory(this, inventory, "armour");
            while (id2 == -1) {
                dao.createInventory(this, inventory, "armour");
                id2 = dao.fetchInventory(this, inventory, "armour");
            }

            dao.saveInventory(this, id2, "armour");
        } catch (DAOException e) {
            throw new RuntimeException(e);
        }
    }
/*
     * Save the inventory specified, if null - saves current inventory.
     * @param name - Name of the new inventory
     */
Save the inventory specified, if null - saves current inventory.
@param name - Name of the new inventory
Save the inventory specified if null - saves current inventory . @param name - Name of the new inventory
public void saveInventory(String name)
    {
        String inventory = name;
        if (name == null) {
            inventory = this.currentInventory;
        }
        try (IContext ctx = plugin.createContext()) {
            IInventoryDAO dao = ctx.getInventoryDAO();
            int id;
            id = dao.fetchInventory(this, inventory, "main");
            while (id == -1) {
                dao.createInventory(this, inventory, "main");
                id = dao.fetchInventory(this, inventory, "main");
            }
            dao.saveInventory(this, id, "main");
            int id2;
            id2 = dao.fetchInventory(this, inventory, "armour");
            while (id2 == -1) {
                dao.createInventory(this, inventory, "armour");
                id2 = dao.fetchInventory(this, inventory, "armour");
            }
            dao.saveInventory(this, id2, "armour");
        } catch (DAOException e) {
            throw new RuntimeException(e);
        }
    }
public void saveInventory ( String name ) { String inventory = name ; if ( name == null ) { inventory = this . currentInventory ; } try ( IContext ctx = plugin . createContext ( ) ) { IInventoryDAO dao = ctx . getInventoryDAO ( ) ; int id ; id = dao . fetchInventory ( this , inventory , "main" ) ; while ( id == - 1 ) { dao . createInventory ( this , inventory , "main" ) ; id = dao . fetchInventory ( this , inventory , "main" ) ; } dao . saveInventory ( this , id , "main" ) ; int id2 ; id2 = dao . fetchInventory ( this , inventory , "armour" ) ; while ( id2 == - 1 ) { dao . createInventory ( this , inventory , "armour" ) ; id2 = dao . fetchInventory ( this , inventory , "armour" ) ; } dao . saveInventory ( this , id2 , "armour" ) ; } catch ( DAOException e ) { throw new RuntimeException ( e ) ; } }
Save the inventory specified, if null - saves current inventory.
Save the inventory specified if null - saves current inventory .