mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-25 09:59:49 -05:00
Force shop database updating in async thread
This commit is contained in:
1 parent
f09bf14fd5
commit
35836c60bc
1 file changed
+9
-7
@@ -711,7 +711,13 @@ public class ContainerShop implements Shop {
|
||||
*/
|
||||
@Override
|
||||
public synchronized void update() {
|
||||
Util.mainThreadRun(this::update0);
|
||||
Util.ensureThread(false);
|
||||
ShopUpdateEvent shopUpdateEvent = new ShopUpdateEvent(this);
|
||||
if (Util.fireCancellableEvent(shopUpdateEvent)) {
|
||||
Util.debugLog("The Shop update action was canceled by a plugin.");
|
||||
return;
|
||||
}
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, this::update0);
|
||||
}
|
||||
|
||||
private void notifyDisplayItemChange() {
|
||||
@@ -722,12 +728,8 @@ public class ContainerShop implements Shop {
|
||||
}
|
||||
|
||||
private void update0() {
|
||||
Util.ensureThread(false);
|
||||
ShopUpdateEvent shopUpdateEvent = new ShopUpdateEvent(this);
|
||||
if (Util.fireCancellableEvent(shopUpdateEvent)) {
|
||||
Util.debugLog("The Shop update action was canceled by a plugin.");
|
||||
return;
|
||||
}
|
||||
// Make sure this only trigged in async thread, we will start the I/O actions
|
||||
Util.ensureThread(true);
|
||||
int x = this.getLocation().getBlockX();
|
||||
int y = this.getLocation().getBlockY();
|
||||
int z = this.getLocation().getBlockZ();
|
||||
|
||||
Reference in new issue
Block a user