Move chr MySQL saving to CharacterSaver
This commit is contained in:
@@ -129,25 +129,21 @@ public class Storage {
|
||||
}
|
||||
}
|
||||
|
||||
public void saveToDB(Connection con) {
|
||||
try {
|
||||
try (PreparedStatement ps = con.prepareStatement("UPDATE storages SET slots = ?, meso = ? WHERE storageid = ?")) {
|
||||
ps.setInt(1, slots);
|
||||
ps.setInt(2, meso);
|
||||
ps.setInt(3, id);
|
||||
ps.executeUpdate();
|
||||
}
|
||||
List<Pair<Item, InventoryType>> itemsWithType = new ArrayList<>();
|
||||
|
||||
List<Item> list = getItems();
|
||||
for (Item item : list) {
|
||||
itemsWithType.add(new Pair<>(item, item.getInventoryType()));
|
||||
}
|
||||
|
||||
ItemFactory.STORAGE.saveItems(itemsWithType, id, con);
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
public void saveToDB(Connection con) throws SQLException {
|
||||
try (PreparedStatement ps = con.prepareStatement("UPDATE storages SET slots = ?, meso = ? WHERE storageid = ?")) {
|
||||
ps.setInt(1, slots);
|
||||
ps.setInt(2, meso);
|
||||
ps.setInt(3, id);
|
||||
ps.executeUpdate();
|
||||
}
|
||||
List<Pair<Item, InventoryType>> itemsWithType = new ArrayList<>();
|
||||
|
||||
List<Item> list = getItems();
|
||||
for (Item item : list) {
|
||||
itemsWithType.add(new Pair<>(item, item.getInventoryType()));
|
||||
}
|
||||
|
||||
ItemFactory.STORAGE.saveItems(itemsWithType, id, con);
|
||||
}
|
||||
|
||||
public Item getItem(byte slot) {
|
||||
|
||||
Reference in New Issue
Block a user