mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-25 09:59:49 -05:00
Only clean and count loaded shops
This commit is contained in:
1 parent
b6fbfed77d
commit
627ff84df5
3 files changed
+5
-4
No files matched your search
@@ -27,6 +27,7 @@ import org.maxgamer.quickshop.command.CommandHandler;
|
||||
import org.maxgamer.quickshop.shop.ContainerShop;
|
||||
import org.maxgamer.quickshop.shop.Shop;
|
||||
import org.maxgamer.quickshop.util.MsgUtil;
|
||||
import org.maxgamer.quickshop.util.Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -45,7 +46,7 @@ public class SubCommand_Clean implements CommandHandler<CommandSender> {
|
||||
|
||||
for (Shop shop : plugin.getShopManager().getAllShops()) {
|
||||
try {
|
||||
if (shop.getLocation().getWorld() != null
|
||||
if (Util.isLoaded(shop.getLocation())
|
||||
&& shop.isSelling()
|
||||
&& shop.getRemainingStock() == 0
|
||||
&& shop instanceof ContainerShop) {
|
||||
|
||||
@@ -74,7 +74,7 @@ public class SubCommand_CleanGhost implements CommandHandler<CommandSender> {
|
||||
Util.mainThreadRun(shop::delete);
|
||||
continue;
|
||||
}
|
||||
if (shop.getLocation().getWorld() == null) {
|
||||
if (!Util.isWorldLoaded(shop.getLocation())) {
|
||||
MsgUtil.sendDirectMessage(sender,
|
||||
ChatColor.YELLOW + "Deleting shop " + shop + " because the its world is not loaded.");
|
||||
Util.mainThreadRun(shop::delete);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class SubCommand_Info implements CommandHandler<CommandSender> {
|
||||
} else if (shop.isSelling()) {
|
||||
selling++;
|
||||
}
|
||||
if (shop.isSelling() && shop.getRemainingStock() == 0) {
|
||||
if (shop.isSelling() && shop.isLoaded() && shop.getRemainingStock() == 0) {
|
||||
nostock++;
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public class SubCommand_Info implements CommandHandler<CommandSender> {
|
||||
ChatColor.GREEN
|
||||
+ ""
|
||||
+ nostock
|
||||
+ " out-of-stock shops (excluding doubles) which will be removed by /qs clean.");
|
||||
+ " out-of-stock loaded shops (excluding doubles) which will be removed by /qs clean.");
|
||||
MsgUtil.sendDirectMessage(sender, ChatColor.GREEN + "QuickShop " + QuickShop.getVersion());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user