diff --git a/src/main/java/de/epiceric/shopchest/ShopChest.java b/src/main/java/de/epiceric/shopchest/ShopChest.java index a1b55ec..0f958f5 100644 --- a/src/main/java/de/epiceric/shopchest/ShopChest.java +++ b/src/main/java/de/epiceric/shopchest/ShopChest.java @@ -324,15 +324,9 @@ public class ShopChest extends JavaPlugin { debug("Disabling ShopChest..."); if (database != null) { - int highestId = database.getHighestID(); - - for (int i = 1; i <= highestId; i++) { - for (Shop shop : shopUtils.getShops()) { - if (shop.getID() == i) { - shopUtils.removeShop(shop, false); - debug("Removed shop (#" + shop.getID() + ")"); - } - } + for (Shop shop : shopUtils.getShops()) { + shopUtils.removeShop(shop, false); + debug("Removed shop (#" + shop.getID() + ")"); } database.disconnect(); diff --git a/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java b/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java index 3186529..d3b5f71 100644 --- a/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java +++ b/src/main/java/de/epiceric/shopchest/utils/ShopUtils.java @@ -4,14 +4,16 @@ import de.epiceric.shopchest.ShopChest; import de.epiceric.shopchest.config.Config; import de.epiceric.shopchest.shop.Shop; import de.epiceric.shopchest.sql.Database; -import org.bukkit.*; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; import org.bukkit.block.Chest; import org.bukkit.block.DoubleChest; import org.bukkit.entity.Player; import org.bukkit.inventory.InventoryHolder; import org.bukkit.permissions.PermissionAttachmentInfo; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; public class ShopUtils { @@ -184,17 +186,13 @@ public class ShopUtils { if (reloadConfig) plugin.getShopChestConfig().reload(false, true, showConsoleMessages); - int highestId = plugin.getShopDatabase().getHighestID(); - - for (int i = 1; i <= highestId; i++) { - for (Shop shop : getShops()) { - if (shop.getID() == i) { - removeShop(shop, false); - plugin.debug("Removed shop (#" + shop.getID() + ")"); - } - } + for (Shop shop : getShops()) { + removeShop(shop, false); + plugin.debug("Removed shop (#" + shop.getID() + ")"); } + int highestId = plugin.getShopDatabase().getHighestID(); + int count = 0; for (int id = 1; id <= highestId; id++) {