mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-22 18:32:24 +00:00
Improve performance while reloading shops
This commit is contained in:
parent
d4a88a2a9b
commit
a522197112
@ -324,16 +324,10 @@ public class ShopChest extends JavaPlugin {
|
|||||||
debug("Disabling ShopChest...");
|
debug("Disabling ShopChest...");
|
||||||
|
|
||||||
if (database != null) {
|
if (database != null) {
|
||||||
int highestId = database.getHighestID();
|
|
||||||
|
|
||||||
for (int i = 1; i <= highestId; i++) {
|
|
||||||
for (Shop shop : shopUtils.getShops()) {
|
for (Shop shop : shopUtils.getShops()) {
|
||||||
if (shop.getID() == i) {
|
|
||||||
shopUtils.removeShop(shop, false);
|
shopUtils.removeShop(shop, false);
|
||||||
debug("Removed shop (#" + shop.getID() + ")");
|
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,16 +186,12 @@ 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 (int i = 1; i <= highestId; i++) {
|
|
||||||
for (Shop shop : getShops()) {
|
for (Shop shop : getShops()) {
|
||||||
if (shop.getID() == i) {
|
|
||||||
removeShop(shop, false);
|
removeShop(shop, false);
|
||||||
plugin.debug("Removed shop (#" + shop.getID() + ")");
|
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