mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-09 20:21:07 +00:00
No world access on plugin disable
This commit is contained in:
parent
4fc8194ceb
commit
0ab51482d2
@ -256,10 +256,8 @@ public class ShopChest extends JavaPlugin {
|
|||||||
shopCreationThreadPool.shutdown();
|
shopCreationThreadPool.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Shop shop : shopUtils.getShops()) {
|
shopUtils.removeShops();
|
||||||
shopUtils.removeShop(shop, false);
|
debug("Removed shops");
|
||||||
debug("Removed shop (#" + shop.getID() + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (database != null && database.isInitialized()) {
|
if (database != null && database.isInitialized()) {
|
||||||
if (database instanceof SQLite) {
|
if (database instanceof SQLite) {
|
||||||
|
@ -132,6 +132,20 @@ public class ShopUtils {
|
|||||||
addShop(shop, addToDatabase, null);
|
addShop(shop, addToDatabase, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes (i.e. unloads) all currently loaded shops
|
||||||
|
*/
|
||||||
|
public void removeShops() {
|
||||||
|
shopLocation.forEach((location, shop) -> {
|
||||||
|
if (!shop.isCreated()) return;
|
||||||
|
|
||||||
|
plugin.debug("Removing shop " + shop.getID());
|
||||||
|
shop.removeItem();
|
||||||
|
shop.removeHologram();
|
||||||
|
});
|
||||||
|
shopLocation.clear();
|
||||||
|
}
|
||||||
|
|
||||||
/** Remove a shop. May not work properly if double chest doesn't exist!
|
/** Remove a shop. May not work properly if double chest doesn't exist!
|
||||||
* @param shop Shop to remove
|
* @param shop Shop to remove
|
||||||
* @param removeFromDatabase Whether the shop should also be removed from the database
|
* @param removeFromDatabase Whether the shop should also be removed from the database
|
||||||
|
Loading…
Reference in New Issue
Block a user