mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-26 04:12:22 +00:00
Improve performance while reloading shops
This commit is contained in:
parent
d4a88a2a9b
commit
a522197112
@ -324,15 +324,9 @@ public class ShopChest extends JavaPlugin {
|
|||||||
debug("Disabling ShopChest...");
|
debug("Disabling ShopChest...");
|
||||||
|
|
||||||
if (database != null) {
|
if (database != null) {
|
||||||
int highestId = database.getHighestID();
|
for (Shop shop : shopUtils.getShops()) {
|
||||||
|
shopUtils.removeShop(shop, false);
|
||||||
for (int i = 1; i <= highestId; i++) {
|
debug("Removed shop (#" + shop.getID() + ")");
|
||||||
for (Shop shop : shopUtils.getShops()) {
|
|
||||||
if (shop.getID() == i) {
|
|
||||||
shopUtils.removeShop(shop, false);
|
|
||||||
debug("Removed shop (#" + shop.getID() + ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
database.disconnect();
|
database.disconnect();
|
||||||
|
@ -4,14 +4,16 @@ import de.epiceric.shopchest.ShopChest;
|
|||||||
import de.epiceric.shopchest.config.Config;
|
import de.epiceric.shopchest.config.Config;
|
||||||
import de.epiceric.shopchest.shop.Shop;
|
import de.epiceric.shopchest.shop.Shop;
|
||||||
import de.epiceric.shopchest.sql.Database;
|
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.Chest;
|
||||||
import org.bukkit.block.DoubleChest;
|
import org.bukkit.block.DoubleChest;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class ShopUtils {
|
public class ShopUtils {
|
||||||
|
|
||||||
@ -184,17 +186,13 @@ public class ShopUtils {
|
|||||||
|
|
||||||
if (reloadConfig) plugin.getShopChestConfig().reload(false, true, showConsoleMessages);
|
if (reloadConfig) plugin.getShopChestConfig().reload(false, true, showConsoleMessages);
|
||||||
|
|
||||||
int highestId = plugin.getShopDatabase().getHighestID();
|
for (Shop shop : getShops()) {
|
||||||
|
removeShop(shop, false);
|
||||||
for (int i = 1; i <= highestId; i++) {
|
plugin.debug("Removed shop (#" + shop.getID() + ")");
|
||||||
for (Shop shop : getShops()) {
|
|
||||||
if (shop.getID() == i) {
|
|
||||||
removeShop(shop, false);
|
|
||||||
plugin.debug("Removed shop (#" + shop.getID() + ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int highestId = plugin.getShopDatabase().getHighestID();
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int id = 1; id <= highestId; id++) {
|
for (int id = 1; id <= highestId; id++) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user