diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 6e87a7e6bb33..8e821b8433a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -152,10 +152,6 @@ object Commands { description = "Using path finder to go to locations" callback { NavigationHelper.onCommand(it) } } - event.register("shcarry") { - description = "Keep track of carries you do." - callback { CarryTracker.onCommand(it) } - } event.register("shmarkplayer") { description = "Add a highlight effect to a player for better visibility" callback { MarkedPlayerManager.command(it) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt index b43625ed2769..217acdad27e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.api.event.HandleEvent +import at.hannibal2.skyhanni.config.commands.CommandRegistrationEvent import at.hannibal2.skyhanni.data.jsonobjects.repo.CarryTrackerJson import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent @@ -32,10 +33,10 @@ import kotlin.time.Duration.Companion.seconds * save on restart * support for Dungeon, Kuudra, crimson minibosses * average spawn time per slayer customer - * change customer name color if offline, onlilne, on your island + * change customer name color if offline, online, on your island * show time since last boss died next to slayer customer name * highlight slayer bosses for slayer customers - * automatically mark customers with /shmarkplaayers + * automatically mark customers with /shmarkplayers * show a line behind them */ @@ -119,12 +120,38 @@ object CarryTracker { config.carryPosition.renderRenderables(display, posLabel = "Carry Tracker") } + @HandleEvent + fun onCommandRegister(event: CommandRegistrationEvent) { + event.register("shcarry") { + description = "Keep track of carries you do." + callback { onCommand(it) } + } + } + fun onCommand(args: Array) { if (args.size < 2 || args.size > 3) { - ChatUtils.userError("Usage:\n§c/shcarry \n§c/shcarry ") + ChatUtils.userError( + "Usage:\n" + + "§c/shcarry \n" + + "§c/shcarry \n" + + "§c/shcarry remove ", + ) return } if (args.size == 2) { + if (args[0] == "remove") { + val customerName = args[1] + for (customer in customers) { + if (customer.name.equals(customerName, ignoreCase = true)) { + customers.remove(customer) + update() + ChatUtils.chat("Removed customer: §b$customerName") + return + } + } + ChatUtils.userError("Customer not found: §b$customerName") + return + } setPrice(args[0], args[1]) return }