From cf7c7f4fde2446b6bc5b305368a067ac993f9b19 Mon Sep 17 00:00:00 2001 From: Empa Date: Sat, 26 Oct 2024 20:24:47 +0200 Subject: [PATCH 1/6] add remove people to carry tracker --- .../skyhanni/config/commands/Commands.kt | 4 --- .../skyhanni/features/misc/CarryTracker.kt | 33 +++++++++++++++++-- 2 files changed, 30 insertions(+), 7 deletions(-) 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 } From 0834fcaaec568c4cf960fd89b708c51533838fd6 Mon Sep 17 00:00:00 2001 From: Empa Date: Sun, 27 Oct 2024 07:17:54 +0100 Subject: [PATCH 2/6] add to hover --- .../java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt | 1 + 1 file changed, 1 insertion(+) 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 217acdad27e7..062a21691f7d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt @@ -262,6 +262,7 @@ object CarryTracker { add("§7Set a price with §e/shcarry ") } add("") + add("§7Run §e/shcarry remove ${customer.name} §7to remove the whole customer!") add("§eClick to send current progress in the party chat!") add("§eControl-click to remove this carry!") }, From d3cbd3c2ba34957d5ebaa1732540bcf311e00aea Mon Sep 17 00:00:00 2001 From: Empa Date: Mon, 28 Oct 2024 21:51:16 +0100 Subject: [PATCH 3/6] detekt, i hate you 3000 --- .../java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt | 1 + 1 file changed, 1 insertion(+) 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 062a21691f7d..1bbca7a54cdc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt @@ -128,6 +128,7 @@ object CarryTracker { } } + @Suppress("ReturnCount") fun onCommand(args: Array) { if (args.size < 2 || args.size > 3) { ChatUtils.userError( From c3564cbd82e43c8dd8bbd08e6a3e804d07ff3233 Mon Sep 17 00:00:00 2001 From: Empa Date: Fri, 1 Nov 2024 21:25:13 +0100 Subject: [PATCH 4/6] hi --- src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt | 1 - 1 file changed, 1 deletion(-) 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 8e821b8433a0..56f1a99a4794 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -64,7 +64,6 @@ import at.hannibal2.skyhanni.features.mining.fossilexcavator.ExcavatorProfitTrac import at.hannibal2.skyhanni.features.mining.glacitemineshaft.CorpseTracker import at.hannibal2.skyhanni.features.mining.powdertracker.PowderTracker import at.hannibal2.skyhanni.features.minion.MinionFeatures -import at.hannibal2.skyhanni.features.misc.CarryTracker import at.hannibal2.skyhanni.features.misc.CollectionTracker import at.hannibal2.skyhanni.features.misc.LockMouseLook import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager From 10a7c479681577ddaf5d4a01fd5aedc6b8e25874 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 11 Nov 2024 20:17:11 +0100 Subject: [PATCH 5/6] code cleanup --- .../at/hannibal2/skyhanni/features/misc/CarryTracker.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 1bbca7a54cdc..8f5a74d1067e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt @@ -128,8 +128,7 @@ object CarryTracker { } } - @Suppress("ReturnCount") - fun onCommand(args: Array) { + private fun onCommand(args: Array) { if (args.size < 2 || args.size > 3) { ChatUtils.userError( "Usage:\n" + @@ -305,8 +304,7 @@ object CarryTracker { ), onClick = { HypixelCommands.partyChat( - "$customerName Carry: already paid: ${paidFormat.removeColor()}, " + - "still missing: ${missingFormat.removeColor()}", + "$customerName Carry: already paid: ${paidFormat.removeColor()}, still missing: ${missingFormat.removeColor()}", ) }, ), From 3c26f0e79b0fa1fe4e8da6001ed8ea6ff871414d Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 11 Nov 2024 20:25:19 +0100 Subject: [PATCH 6/6] FIx dEtEcT --- .../java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt | 1 + 1 file changed, 1 insertion(+) 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 8f5a74d1067e..ca4c71d7ffd0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CarryTracker.kt @@ -128,6 +128,7 @@ object CarryTracker { } } + @Suppress("ReturnCount") private fun onCommand(args: Array) { if (args.size < 2 || args.size > 3) { ChatUtils.userError(