mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-22 10:22:29 +00:00
Fixed Bugs
This commit is contained in:
parent
cfa719ef37
commit
207b249019
@ -2,7 +2,7 @@
|
||||
|
||||
name: ShopChest
|
||||
main: de.epiceric.shopchest.ShopChest
|
||||
version: 1.5.3
|
||||
version: 1.5.4
|
||||
author: EpicEric
|
||||
website: https://www.spigotmc.org/resources/shopchest.11431/
|
||||
depend: [Vault]
|
||||
|
@ -83,6 +83,7 @@ public class ShopChest extends JavaPlugin{
|
||||
return perm != null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
||||
@ -107,6 +108,9 @@ public class ShopChest extends JavaPlugin{
|
||||
logger.severe("Could not submit stats.");
|
||||
}
|
||||
|
||||
reloadConfig();
|
||||
saveDefaultConfig();
|
||||
|
||||
sqlite = new SQLite(this);
|
||||
sqlite.load();
|
||||
|
||||
@ -137,8 +141,7 @@ public class ShopChest extends JavaPlugin{
|
||||
setupPermissions();
|
||||
|
||||
instance = this;
|
||||
reloadConfig();
|
||||
saveDefaultConfig();
|
||||
|
||||
|
||||
UpdateChecker uc = new UpdateChecker(this, getDescription().getWebsite());
|
||||
logger.info("Checking for Updates");
|
||||
@ -206,7 +209,7 @@ public class ShopChest extends JavaPlugin{
|
||||
|
||||
int count = 0;
|
||||
|
||||
for (int id = 1; id < sqlite.getCount() + 1; id++) {
|
||||
for (int id = 1; id < sqlite.getHighestID() + 1; id++) {
|
||||
|
||||
try {
|
||||
Shop shop = sqlite.getShop(id);
|
||||
|
@ -36,7 +36,7 @@ public class Utils_R1 extends Utils {
|
||||
|
||||
int count = 0;
|
||||
|
||||
for (int id = 1; id < ShopChest.sqlite.getCount() + 1; id++) {
|
||||
for (int id = 1; id < ShopChest.sqlite.getHighestID() + 1; id++) {
|
||||
|
||||
try {
|
||||
Shop shop = ShopChest.sqlite.getShop(id);
|
||||
|
@ -37,7 +37,7 @@ public class Utils_R2 extends Utils {
|
||||
|
||||
int count = 0;
|
||||
|
||||
for (int id = 1; id < ShopChest.sqlite.getCount() + 1; id++) {
|
||||
for (int id = 1; id < ShopChest.sqlite.getHighestID() + 1; id++) {
|
||||
|
||||
try {
|
||||
Shop shop = ShopChest.sqlite.getShop(id);
|
||||
|
@ -36,7 +36,7 @@ public class Utils_R3 extends Utils {
|
||||
|
||||
int count = 0;
|
||||
|
||||
for (int id = 1; id < ShopChest.sqlite.getCount() + 1; id++) {
|
||||
for (int id = 1; id < ShopChest.sqlite.getHighestID() + 1; id++) {
|
||||
|
||||
try {
|
||||
Shop shop = ShopChest.sqlite.getShop(id);
|
||||
|
@ -101,6 +101,11 @@ public class Shop {
|
||||
}
|
||||
|
||||
} else {
|
||||
try {
|
||||
throw new Exception("No Chest found at specified Location: " + b.getX() + "; " + b.getY() + "; " + b.getZ());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -54,25 +54,25 @@ public abstract class Database {
|
||||
}
|
||||
|
||||
public int getNextFreeID() {
|
||||
for (int i = 1; i < getCount() + 1; i++) {
|
||||
for (int i = 1; i < getHighestID() + 1; i++) {
|
||||
if (getProduct(i) == null) {
|
||||
return i;
|
||||
} else {
|
||||
if (i == getCount()) {
|
||||
if (i == getHighestID()) {
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
public int getHighestID() {
|
||||
Connection conn = null;
|
||||
PreparedStatement ps = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
int highestID = 0;
|
||||
int highestID = 1;
|
||||
try {
|
||||
conn = getSQLConnection();
|
||||
ps = conn.prepareStatement("SELECT * FROM " + table + ";");
|
||||
@ -97,13 +97,13 @@ public abstract class Database {
|
||||
plugin.getLogger().log(Level.SEVERE, Errors.sqlConnectionClose(), ex);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getShopID(Shop shop) {
|
||||
|
||||
|
||||
for (int i = 1; i < getCount() + 1; i++) {
|
||||
for (int i = 1; i < getHighestID() + 1; i++) {
|
||||
|
||||
try {
|
||||
Shop s = getShop(i);
|
||||
|
Loading…
Reference in New Issue
Block a user