Skip to content

Commit 3b2b625

Browse files
Optimize shop load logic
1 parent f5af55c commit 3b2b625

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main/java/org/maxgamer/quickshop/shop/ShopLoader.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,19 @@ public void loadShops(@Nullable String worldName) {
144144
continue;
145145
}
146146
++valid;
147+
148+
Location shopLocation = shop.getLocation();
147149
//World unloaded but found
148-
if (!shop.getLocation().isWorldLoaded()) {
150+
if (!shopLocation.isWorldLoaded()) {
149151
++loadAfterWorldLoaded;
150152
continue;
151153
}
152154
// Load to RAM
153-
plugin.getShopManager().loadShop(data.getWorld().getName(), shop);
155+
plugin.getShopManager().loadShop(shopLocation.getWorld().getName(), shop);
154156

155-
if (Util.isLoaded(shop.getLocation())) {
157+
if (Util.isLoaded(shopLocation)) {
156158
// Load to World
157-
if (!Util.canBeShop(shop.getLocation().getBlock())) {
159+
if (!Util.canBeShop(shopLocation.getBlock())) {
158160
Util.debugLog("Target block can't be a shop, removing it from the memory...");
159161
// shop.delete();
160162
plugin.getShopManager().removeShop(shop); // Remove from Mem
@@ -173,9 +175,7 @@ public void loadShops(@Nullable String worldName) {
173175
try {
174176
shop.onLoad();
175177
} catch (IllegalStateException exception) {
176-
plugin.getShopManager().loadShop(shop.getLocation().getWorld().getName(), shop);
177-
plugin.getSentryErrorReporter().sendError(exception);
178-
shop.onLoad();
178+
exceptionHandler(exception, shop.getLocation());
179179
}
180180
shop.update();
181181
}

0 commit comments

Comments
 (0)