|
10 | 10 | import de.hysky.skyblocker.config.configs.UIAndVisualsConfig; |
11 | 11 | import de.hysky.skyblocker.debug.Debug; |
12 | 12 | import de.hysky.skyblocker.injected.SkyblockerStack; |
| 13 | +import de.hysky.skyblocker.skyblock.AuctionBazaarAutocomplete; |
13 | 14 | import de.hysky.skyblocker.skyblock.item.tooltip.info.TooltipInfoType; |
14 | 15 | import de.hysky.skyblocker.skyblock.itemlist.ItemRepository; |
15 | 16 | import de.hysky.skyblocker.skyblock.museum.Donation; |
|
19 | 20 | import de.hysky.skyblocker.utils.FlexibleItemStack; |
20 | 21 | import de.hysky.skyblocker.utils.ItemUtils; |
21 | 22 | import de.hysky.skyblocker.utils.NEURepoManager; |
| 23 | +import de.hysky.skyblocker.utils.Utils; |
22 | 24 | import de.hysky.skyblocker.utils.scheduler.MessageScheduler; |
23 | 25 | import io.github.moulberry.repo.data.NEUItem; |
24 | 26 | import io.github.moulberry.repo.util.NEUId; |
@@ -89,17 +91,30 @@ public static void init() { |
89 | 91 |
|
90 | 92 | private static void registerSearchCommands(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandBuildContext registryAccess) { |
91 | 93 | if (SkyblockerConfigManager.get().uiAndVisuals.searchOverlay.enableCommands) { |
92 | | - dispatcher.register(literal("ahs").executes(_ -> startCommand(true, ""))); |
93 | | - dispatcher.register(literal("ahsearch").executes(_ -> startCommand(true, ""))); |
94 | | - dispatcher.register(literal("bzs").executes(_ -> startCommand(false, ""))); |
95 | | - |
96 | | - dispatcher.register(literal("ahs").then(argument("item", StringArgumentType.greedyString()) |
| 94 | + dispatcher.register(literal("ahs") |
| 95 | + .requires(_ -> Utils.isOnSkyblock()) |
| 96 | + .executes(_ -> startCommand(true, ""))); |
| 97 | + dispatcher.register(literal("ahsearch") |
| 98 | + .requires(_ -> Utils.isOnSkyblock()) |
| 99 | + .executes(_ -> startCommand(true, ""))); |
| 100 | + dispatcher.register(literal("bzs") |
| 101 | + .requires(_ -> Utils.isOnSkyblock()) |
| 102 | + .executes(_ -> startCommand(false, ""))); |
| 103 | + |
| 104 | + dispatcher.register(literal("ahs") |
| 105 | + .requires(_ -> Utils.isOnSkyblock()) |
| 106 | + .then(argument("item", StringArgumentType.greedyString()) |
97 | 107 | .executes(context -> startCommand(true, StringArgumentType.getString(context, "item")) |
98 | 108 | ))); |
99 | | - dispatcher.register(literal("ahsearch").then(argument("item", StringArgumentType.greedyString()) |
| 109 | + dispatcher.register(literal("ahsearch") |
| 110 | + .requires(_ -> Utils.isOnSkyblock()) |
| 111 | + .then(argument("item", StringArgumentType.greedyString()) |
100 | 112 | .executes(context -> startCommand(true, StringArgumentType.getString(context, "item")) |
101 | 113 | ))); |
102 | | - dispatcher.register(literal("bzs").then(argument("item", StringArgumentType.greedyString()) |
| 114 | + dispatcher.register(literal("bzs") |
| 115 | + .requires(_ -> Utils.isOnSkyblock()) |
| 116 | + .then(argument("item", StringArgumentType.greedyString()) |
| 117 | + .suggests(AuctionBazaarAutocomplete::suggestBzs) |
103 | 118 | .executes(context -> startCommand(false, StringArgumentType.getString(context, "item")) |
104 | 119 | ))); |
105 | 120 | } |
|
0 commit comments