@@ -28,11 +28,6 @@ public SubCommand_Clean(final QuickShop plugin) {
2828 public void onCommand (@ NotNull final CommandSender sender , @ NotNull final String commandLabel , @ NotNull final CommandParser parser ) {
2929
3030 plugin .text ().of (sender , "command.cleaning" ).send ();
31- Util .mainThreadRun (() -> executeClean (sender ));
32- }
33-
34- private void executeClean (@ NotNull final CommandSender sender ) {
35-
3631 final List <Shop > pendingRemoval = new ArrayList <>();
3732 int i = 0 ;
3833
@@ -45,19 +40,20 @@ private void executeClean(@NotNull final CommandSender sender) {
4540 shop ); // Is selling, but has no stock, and is a chest shop, but is not a double shop.
4641 // Can be deleted safely.
4742 i ++;
48- }
49- if (plugin .getShopItemBlackList ().isBlacklisted (shop .getItem ())) {
43+ } else if (plugin .getShopItemBlackList ().isBlacklisted (shop .getItem ())) {
5044 pendingRemoval .add (shop );
5145 i ++;
5246 }
5347 } catch (final IllegalStateException e ) {
54- pendingRemoval .add (shop ); // The shop is not there anymore, remove it
48+ pendingRemoval .add (shop );
5549 }
5650 }
5751
5852 for (final Shop shop : pendingRemoval ) {
59- plugin .logEvent (new ShopRemoveLog (QUserImpl .createFullFilled (CommonUtil .getNilUniqueId (), "SYSTEM" , false ), "/quickshop clean" , shop .saveToInfoStorage ()));
60- plugin .getShopManager ().deleteShop (shop );
53+ Util .regionThread (shop .getLocation (), () -> {
54+ plugin .logEvent (new ShopRemoveLog (QUserImpl .createFullFilled (CommonUtil .getNilUniqueId (), "SYSTEM" , false ), "/quickshop clean" , shop .saveToInfoStorage ()));
55+ plugin .getShopManager ().deleteShop (shop );
56+ });
6157 }
6258
6359 MsgUtil .clean ();
0 commit comments