mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-12-23 01:21:47 +00:00
Fixed Database Entry Removal
This commit is contained in:
parent
f1e034add0
commit
2f5945c536
@ -54,7 +54,7 @@ public abstract class Database {
|
||||
}
|
||||
|
||||
public int getNextFreeID() {
|
||||
for (int i = 1; i <= getCount(); i++) {
|
||||
for (int i = 1; i < getCount() + 1; i++) {
|
||||
if (getProduct(i) == null) {
|
||||
return i;
|
||||
} else {
|
||||
@ -120,7 +120,7 @@ public abstract class Database {
|
||||
}
|
||||
|
||||
public void removeShop(Shop shop) {
|
||||
|
||||
|
||||
int id = getShopID(shop);
|
||||
if (id == 0) return;
|
||||
|
||||
@ -131,6 +131,7 @@ public abstract class Database {
|
||||
try {
|
||||
conn = getSQLConnection();
|
||||
ps = conn.prepareStatement("DELETE FROM " + table + " where id = " + id + ";");
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException ex) {
|
||||
plugin.getLogger().log(Level.SEVERE, Errors.sqlConnectionExecute(), ex);
|
||||
} finally {
|
||||
|
Loading…
Reference in New Issue
Block a user