Reload shop when world loading.

Former-commit-id: bda31064d3ccfc21894b2ae6e770a33a74977bca [formerly 979f5f6b054b4be82bcc7d5bfb79ec0620a0a807]
Former-commit-id: 86c5d79b6c2d6174dbd02816b03e7248108babd9
This commit is contained in:
Ghost_chu committed 2019-06-15 21:26:10 +08:00
1 parent 4539113e0a
commit 006e73f768
2 files changed
+8 -2

No files matched your search

@@ -30,7 +30,9 @@ public class WorldListener implements Listener {
* world value is the same.
* ************************************
*/
World world = e.getWorld();
plugin.getShopLoader().loadShops(world.getName());
// New world data
HashMap<ShopChunk, HashMap<Location, Shop>> inWorld = new HashMap<ShopChunk, HashMap<Location, Shop>>(1);
// Old world data
@@ -37,10 +37,13 @@ public class ShopLoader {
this.plugin = plugin;
}
public void loadShops() {
loadShops(null);
}
/**
* Load all shops
*/
public void loadShops() {
public void loadShops(String worldName) {
Timer totalLoadTimer = new Timer(true);
try {
@@ -52,7 +55,8 @@ public class ShopLoader {
Timer singleShopLoadTimer = new Timer(true);
ShopDatabaseInfoOrigin origin = new ShopDatabaseInfoOrigin(rs);
if (worldName != null && !origin.getWorld().equals(worldName))
continue;
ShopDatabaseInfo data = new ShopDatabaseInfo(origin);
Shop shop = new ContainerShop(data.getLocation(), data.getPrice(), data.getItem(), data.getModerators(), data