private void swap(IItem source, IItem target) { inventory.remove(source.getPosition()); inventory.remove(target.getPosition()); byte swapPos = source.getPosition(); source.setPosition(target.getPosition()); target.setPosition(swapPos); inventory.put(source.getPosition(), source); inventory.put(target.getPosition(), target); }
public void addFromDB(IItem item) { if (item.getPosition() < 0 && !type.equals(MapleInventoryType.EQUIPPED)) { throw new RuntimeException("Item with negative position in non-equipped IV wtf?"); } inventory.put(item.getPosition(), item); }