diff options
34 files changed, 113 insertions, 104 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 76f64a3a4..7f4475287 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -24,15 +24,12 @@ import at.hannibal2.skyhanni.features.event.diana.GriffinBurrowHelper import at.hannibal2.skyhanni.features.event.diana.InquisitorWaypointShare import at.hannibal2.skyhanni.features.event.diana.MythologicalCreatureTracker import at.hannibal2.skyhanni.features.event.jerry.frozentreasure.FrozenTreasureTracker -import at.hannibal2.skyhanni.features.fame.AccountUpgradeReminder -import at.hannibal2.skyhanni.features.fame.CityProjectFeatures import at.hannibal2.skyhanni.features.fishing.tracker.FishingProfitTracker import at.hannibal2.skyhanni.features.fishing.tracker.SeaCreatureTracker import at.hannibal2.skyhanni.features.garden.FarmingMilestoneCommand import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.GardenCropTimeCommand import at.hannibal2.skyhanni.features.garden.GardenCropsInCommand -import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest import at.hannibal2.skyhanni.features.garden.SensitivityReducer import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay import at.hannibal2.skyhanni.features.garden.farming.ArmorDropTracker @@ -71,7 +68,6 @@ import at.hannibal2.skyhanni.test.command.CopyItemCommand import at.hannibal2.skyhanni.test.command.CopyNearbyEntitiesCommand import at.hannibal2.skyhanni.test.command.CopyNearbyParticlesCommand import at.hannibal2.skyhanni.test.command.CopyScoreboardCommand -import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.test.command.TestChatCommand import at.hannibal2.skyhanni.test.command.TrackSoundsCommand import at.hannibal2.skyhanni.utils.APIUtil @@ -192,24 +188,24 @@ object Commands { "Clear farming items saved for the Farming Fortune Guide" ) { clearFarmingItems() } registerCommand("shresetghostcounter", "Resets the ghost counter") { GhostUtil.reset() } - registerCommand("shresetpowdertracker", "Resets the Powder Tracker") { PowderTracker.resetCommand(it) } - registerCommand("shresetdicertracker", "Resets the Dicer Drop Tracker") { DicerRngDropTracker.resetCommand(it) } + registerCommand("shresetpowdertracker", "Resets the Powder Tracker") { PowderTracker.resetCommand() } + registerCommand("shresetdicertracker", "Resets the Dicer Drop Tracker") { DicerRngDropTracker.resetCommand() } registerCommand( "shresetendernodetracker", "Resets the Ender Node Tracker" - ) { EnderNodeTracker.resetCommand(it) } + ) { EnderNodeTracker.resetCommand() } registerCommand( "shresetarmordroptracker", "Resets the Armor Drop Tracker" - ) { ArmorDropTracker.resetCommand(it) } + ) { ArmorDropTracker.resetCommand() } registerCommand( "shresetfrozentreasuretracker", "Resets the Frozen Treasure Tracker" - ) { FrozenTreasureTracker.resetCommand(it) } + ) { FrozenTreasureTracker.resetCommand() } registerCommand( "shresetfishingtracker", "Resets the Fishing Profit Tracker" - ) { FishingProfitTracker.resetCommand(it) } + ) { FishingProfitTracker.resetCommand() } registerCommand( "shresetvisitordrops", "Reset the Visitors Drop Statistics" @@ -239,23 +235,23 @@ object Commands { registerCommand( "shresetvermintracker", "Resets the Vermin Tracker" - ) { VerminTracker.resetCommand(it) } + ) { VerminTracker.resetCommand() } registerCommand( "shresetdianaprofittracker", "Resets the Diana Profit Tracker" - ) { DianaProfitTracker.resetCommand(it) } + ) { DianaProfitTracker.resetCommand() } registerCommand( "shresetpestprofittracker", "Resets the Pest Profit Tracker" - ) { PestProfitTracker.resetCommand(it) } + ) { PestProfitTracker.resetCommand() } registerCommand( "shresetmythologicalcreatureracker", "Resets the Mythological Creature Tracker" - ) { MythologicalCreatureTracker.resetCommand(it) } + ) { MythologicalCreatureTracker.resetCommand() } registerCommand( "shresetseacreaturetracker", "Resets the Sea Creature Tracker" - ) { SeaCreatureTracker.resetCommand(it) } + ) { SeaCreatureTracker.resetCommand() } registerCommand( "shfandomwiki", "Searches the fandom wiki with SkyHanni's own method." @@ -404,7 +400,7 @@ object Commands { "Find config elements that are null and prints them into the console" ) { SkyHanniDebugsAndTests.findNullConfig(it) } registerCommand("shtestwaypoint", "Set a waypoint on that location") { SkyHanniDebugsAndTests.waypoint(it) } - registerCommand("shtesttablist", "Set your clipboard as a fake tab list.") { TabListData.toggleDebugCommand() } + registerCommand("shtesttablist", "Set your clipboard as a fake tab list.") { TabListData.toggleDebug() } registerCommand("shreloadlocalrepo", "Reloading the local repo data") { SkyHanniMod.repo.reloadLocalRepo() } registerCommand("shchathistory", "Show the unfiltered chat history") { ChatManager.openChatFilterGUI(it) } registerCommand( @@ -475,7 +471,7 @@ object Commands { registerCommand( "shconfigmanagerreset", "Reloads the config manager and rendering processors of MoulConfig. This §cWILL RESET §7your config, but also updating the java config files (names, description, orderings and stuff)." - ) { SkyHanniDebugsAndTests.configManagerResetCommand(it) } + ) { SkyHanniDebugsAndTests.configManagerResetCommand() } registerCommand( "readcropmilestonefromclipboard", "Read crop milestone from clipboard. This helps fixing wrong crop milestone data" @@ -491,12 +487,7 @@ object Commands { } private fun internalCommands() { - registerCommand("shshareinquis", "") { InquisitorWaypointShare.sendInquisitor() } - registerCommand("shcopyerror", "") { ErrorManager.command(it) } - registerCommand("shstopcityprojectreminder", "") { CityProjectFeatures.disable() } - registerCommand("shsendcontests", "") { GardenNextJacobContest.shareContestConfirmed(it) } registerCommand("shwords", "Opens the config list for modifying visual words") { openVisualWords() } - registerCommand("shstopaccountupgradereminder", "") { AccountUpgradeReminder.disable() } registerCommand("shaction", "") { ChatClickActionManager.onCommand(it) } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt index fc024a4c8..29a22138d 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt @@ -177,7 +177,9 @@ class RepoManager(private val configLocation: File) { if (error) { ChatUtils.clickableChat( "Error with the repo detected, try /shupdaterepo to fix it!", - "shupdaterepo", + onClick = { + SkyHanniMod.repo.updateRepo() + }, prefixColor = "§c" ) if (unsuccessfulConstants.isEmpty()) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt index a8ccc5a85..aa462726a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt @@ -257,7 +257,7 @@ object EnderNodeTracker { return newList } - fun resetCommand(args: Array<String>) { - tracker.resetCommand(args, "shresetendernodetracker") + fun resetCommand() { + tracker.resetCommand() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt index 0b0a444d9..dcac24f63 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt @@ -24,8 +24,8 @@ import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil.isUsingCTGho import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil.preFormat import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostUtil.prettyTime import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarApi.Companion.getBazaarData +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ChatUtils.chat -import at.hannibal2.skyhanni.utils.ChatUtils.clickableChat import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.CombatUtils._isKilling import at.hannibal2.skyhanni.utils.CombatUtils.calculateETA @@ -318,9 +318,11 @@ object GhostCounter { if (notifyCTModule && ProfileStorageData.profileSpecific?.ghostCounter?.ctDataImported != true) { notifyCTModule = false if (isUsingCTGhostCounter()) { - clickableChat( + ChatUtils.clickableChat( "GhostCounterV3 ChatTriggers module has been detected, do you want to import saved data ? Click here to import data", - "shimportghostcounterdata", + onClick = { + GhostUtil.importCTGhostCounterData() + }, prefixColor = "§6", ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt index 25b20b08a..4efc872a4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt @@ -149,8 +149,8 @@ object DianaProfitTracker { allowedDrops = event.getConstant<DianaDrops>("DianaDrops").diana_drops } - fun resetCommand(args: Array<String>) { - tracker.resetCommand(args, "shresetdianaprofittracker") + fun resetCommand() { + tracker.resetCommand() } private fun isEnabled() = DianaAPI.isDoingDiana() && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index 33f7efab4..25fba4ceb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -172,7 +172,9 @@ object InquisitorWaypointShare { val keyName = KeyboardManager.getKeyName(config.keyBindShare) val message = "§l§bYou found a Inquisitor! Press §l§chere §l§bor §c$keyName to share the location!" - ChatUtils.clickableChat(message, "shshareinquis") + ChatUtils.clickableChat(message, onClick = { + sendInquisitor() + }) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt index 6b40b43db..0507f4b74 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/MythologicalCreatureTracker.kt @@ -127,8 +127,8 @@ object MythologicalCreatureTracker { tracker.renderDisplay(config.position) } - fun resetCommand(args: Array<String>) { - tracker.resetCommand(args, "shresetmythologicalcreatureracker") + fun resetCommand() { + tracker.resetCommand() } private fun isEnabled() = DianaAPI.isDoingDiana() && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt index fbd9e246b..58659dce8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt @@ -190,7 +190,7 @@ object FrozenTreasureTracker { private fun inGlacialCave() = onJerryWorkshop() && ScoreboardData.sidebarLinesFormatted.contains(" §7⏣ §3Glacial Cave") - fun resetCommand(args: Array<String>) { - tracker.resetCommand(args, "shresetfrozentreasuretracker") + fun resetCommand() { + tracker.resetCommand() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt index ca700e2b1..74645000a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/AccountUpgradeReminder.kt @@ -50,7 +50,9 @@ class AccountUpgradeReminder { ChatUtils.clickableChat( "The §a$upgrade §eupgrade has completed! §c(Click to disable these reminders)", - "shstopaccountupgradereminder" + onClick = { + disable() + } ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt index f5f45862e..d9631f55d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt @@ -80,7 +80,9 @@ class CityProjectFeatures { ChatUtils.clickableChat( "Daily City Project Reminder! (Click here to disable this reminder)", - "shstopcityprojectreminder" + onClick = { + disable() + } ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt index f13ea5824..b2eae869b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt @@ -237,8 +237,8 @@ object FishingProfitTracker { tracker.firstUpdate() } - fun resetCommand(args: Array<String>) { - tracker.resetCommand(args, "shresetfishingtracker") + fun resetCommand() { + tracker.resetCommand() } fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && !LorenzUtils.inKuudraFight diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt index 5eab75fbd..847449e77 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/SeaCreatureTracker.kt @@ -167,8 +167,8 @@ object SeaCreatureTracker { tracker.renderDisplay(config.position) } - fun resetCommand(args: Array<String>) { - tracker.resetCommand(args, "shresetseacreaturetracker") + fun resetCommand() { + tracker.resetCommand() } private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled && !isTrophyFishing && !LorenzUtils.inKuudraFight diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt index 566589358..e39387c97 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt @@ -94,7 +94,7 @@ class GardenLevelDisplay { ChatUtils.clickableChat( " \n§b§lGARDEN LEVEL UP §8$oldLevel ➜ §b$newLevel\n" + " §8+§aRespect from Elite Farmers and SkyHanni members :)\n ", - "/gardenlevels", + "gardenlevels", false ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index 471fc7e35..82ccc9a93 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -246,7 +246,9 @@ object GardenNextJacobContest { } else { ChatUtils.clickableChat( "§2Click here to submit this year's farming contests. Thank you for helping everyone out!", - "shsendcontests" + onClick = { + shareContests() + } ) } } @@ -289,22 +291,18 @@ object GardenNextJacobContest { } } - fun shareContestConfirmed(array: Array<String>) { - if (array.size == 1) { - if (array[0] == "enable") { - config.shareAutomatically = ShareContestsEntry.AUTO - SkyHanniMod.feature.storage.contestSendingAsked = true - ChatUtils.chat("§2Enabled automatic sharing of future contests!") - } - return - } + private fun shareContests() { if (contests.size == MAX_CONTESTS_PER_YEAR) { sendContests() } if (!SkyHanniMod.feature.storage.contestSendingAsked && config.shareAutomatically == ShareContestsEntry.ASK) { ChatUtils.clickableChat( "§2Click here to automatically share future contests!", - "shsendcontests enable" + onClick = { + config.shareAutomatically = ShareContestsEntry.AUTO + SkyHanniMod.feature.storage.contestSendingAsked = true + ChatUtils.chat("§2Enabled automatic sharing of future contests!") + } ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt index 46ff67a2b..be7008e36 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/ArmorDropTracker.kt @@ -165,7 +165,7 @@ object ArmorDropTracker { } } - fun resetCommand(args: Array<String>) { - tracker.resetCommand(args, "shresetarmordroptracker") + fun resetCommand() { + tracker.resetCommand() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt index 49d38d7ba..6638cf2fa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt @@ -172,7 +172,7 @@ object DicerRngDropTracker { } } - fun resetCommand(args: Array<String>) { - tracker.resetCommand(args, "shresetdicertracker") + fun resetCommand() { + tracker.resetCommand() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneAPI.kt index 6ab266f44..9663f67f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/lane/FarmingLaneAPI.kt @@ -50,7 +50,9 @@ object FarmingLaneAPI { ChatUtils.clickableChat( "No ${crop.cropName} lane defined yet! Use §e/shlanedetection", - command = "shlanedetection" + onClick = { + FarmingLaneCreator.commandLaneDetection() + } ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt index 8d6947ef7..bad0003d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt @@ -139,8 +139,8 @@ object PestProfitTracker { } } - fun resetCommand(args: Array<String>) { - tracker.resetCommand(args, "shresetpestprofittracker") + fun resetCommand() { + tracker.resetCommand() } fun isEnabled() = GardenAPI.inGarden() && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt index 1faa94c81..447396d43 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/HighlightVisitorsOutsideOfGarden.kt @@ -97,9 +97,8 @@ class HighlightVisitorsOutsideOfGarden { if (isVisitor(entity) || (entity is EntityArmorStand && isVisitorNearby(entity.getLorenzVec()))) { event.isCanceled = true if (packet.action == C02PacketUseEntity.Action.INTERACT) { - ChatUtils.clickableChat( - "Blocked you from interacting with a visitor. Sneak to bypass or click here to change settings.", - "/sh block interacting with visitors" + ChatUtils.chatAndOpenConfig("Blocked you from interacting with a visitor. Sneak to bypass or click here to change settings.", + GardenAPI.config.visitors::blockInteracting ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/DojoRankDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/DojoRankDisplay.kt index 854063a07..85000714e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/DojoRankDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/DojoRankDisplay.kt @@ -41,6 +41,7 @@ class DojoRankDisplay { private fun drawDisplay(items: Collection<ItemStack>) = buildList { if (belts.isEmpty()) { + // TODO make clickable add("§cUnable to get Belts data, please run /shupdaterepo") return@buildList } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt index f0b72c539..94bb86d03 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsGuide.kt @@ -107,7 +107,9 @@ class DeepCavernsGuide { if (parkourHelper == null) { ChatUtils.clickableChat( "DeepCavernsParkour missing in SkyHanni Repo! Try /shupdaterepo to fix it!", - "shupdaterepo", + onClick = { + SkyHanniMod.repo.updateRepo() + }, prefixColor = "§c" ) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt index 5ce5cef87..8940c9f59 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt @@ -371,7 +371,7 @@ object PowderTracker { private fun isEnabled() = IslandType.CRYSTAL_HOLLOWS.isInIsland() && config.enabled - fun resetCommand(args: Array<String>) { - tracker.resetCommand(args, "shresetpowdertracker") + fun resetCommand() { + tracker.resetCommand() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt index 60769b579..606dd7480 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt @@ -78,7 +78,10 @@ object DiscordRPCManager : IPCListener { ChatUtils.clickableChat( "Discord Rich Presence was unable to start! " + "This usually happens when you join SkyBlock when Discord is not started. " + - "Please run /shrpcstart to retry once you have launched Discord.", "shrpcstart" + "Please run /shrpcstart to retry once you have launched Discord.", + onClick = { + startCommand() + } ) } } catch (ex: Throwable) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt index ae7d22c41..8197c8ba9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt @@ -36,7 +36,9 @@ object DefaultConfigFeatures { ChatUtils.clickableChat( "Looks like this is the first time you are using SkyHanni. " + "Click here to configure default options, or run /shdefaultoptions.", - "shdefaultoptions" + onClick = { + onCommand("null", "null") + } ) } else if (updated) { val lastVersion = knownToggles.keys.last { it != SkyHanniMod.version } @@ -44,7 +46,9 @@ object DefaultConfigFeatures { ChatUtils.clickableChat( "Looks like you updated SkyHanni. " + "Click here to configure the newly introduced options, or run $command.", - command + onClick = { + onCommand(lastVersion, SkyHanniMod.version) + } ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt index 0377e1467..4c6919eea 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt @@ -8,9 +8,9 @@ import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle import at.hannibal2.skyhanni.utils.LorenzLogger import com.google.gson.JsonElement -import io.github.notenoughupdates.moulconfig.processor.MoulConfigProcessor import io.github.moulberry.notenoughupdates.util.ApiUtil import io.github.moulberry.notenoughupdates.util.MinecraftExecutor +import io.github.notenoughupdates.moulconfig.processor.MoulConfigProcessor import moe.nea.libautoupdate.CurrentVersion import moe.nea.libautoupdate.PotentialUpdate import moe.nea.libautoupdate.UpdateContext @@ -99,10 +99,10 @@ object UpdateManager { ChatUtils.chat("§aSkyHanni found a new update: ${it.update.versionName}, starting to download now. ") queueUpdate() } else if (config.autoUpdates) { - ChatUtils.clickableChat( + ChatUtils.chatAndOpenConfig( "§aSkyHanni found a new update: ${it.update.versionName}. " + "Check §b/sh download update §afor more info.", - "sh" + SkyHanniMod.feature.about::autoUpdates ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt index 7c6828f2e..30a98b54a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt @@ -37,6 +37,7 @@ object DanceRoomHelper { if (instructions.isEmpty()) { add("§cError fetching Dance Room Instructions!") add("§cTry §e/shreloadlocalrepo §cor §e/shupdaterepo") + // TODO make clickable } for ((lineIndex, line) in instructions.withIndex()) { addLine(lineIndex, line)?.let { add(it) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt index 0d349e9fb..afbfa2920 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt @@ -176,8 +176,8 @@ object VerminTracker { } } - fun resetCommand(args: Array<String>) { - tracker.resetCommand(args, "shresetvermintracker") + fun resetCommand() { + tracker.resetCommand() } private fun isEnabled() = RiftAPI.inRift() && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt index 711b49ffa..2187a72e1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt @@ -249,6 +249,6 @@ object SlayerProfitTracker { return } - getTracker()?.resetCommand(args, "shclearslayerprofits") + getTracker()?.resetCommand() } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index 43e3974da..0d820f09a 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -190,16 +190,13 @@ class SkyHanniDebugsAndTests { } } - fun configManagerResetCommand(args: Array<String>) { - if (args.size == 1 && args[0] == "confirm") { - configManagerReset() - return - } - + fun configManagerResetCommand() { ChatUtils.clickableChat( "§cTHIS WILL RESET YOUR SkyHanni CONFIG! Click here to procceed.", - "shconfigmanagerreset confirm", - false + onClick = { + configManagerReset() + }, + prefix = false ) } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt index 8c82ff0cd..622aaeba1 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt @@ -62,18 +62,12 @@ object ErrorManager { throw exception } - fun command(array: Array<String>) { - if (array.size != 1) { - ChatUtils.userError("Use /shcopyerror <error id>") - return - } - - val id = array[0] + private fun copyError(errorId: String) { val fullErrorMessage = KeyboardManager.isModifierKeyDown() val errorMessage = if (fullErrorMessage) { - fullErrorMessages[id] + fullErrorMessages[errorId] } else { - errorMessages[id] + errorMessages[errorId] } val name = if (fullErrorMessage) "Full error" else "Error" ChatUtils.chat(errorMessage?.let { @@ -152,8 +146,10 @@ object ErrorManager { ChatUtils.clickableChat( "§c[SkyHanni-${SkyHanniMod.version}]: $message§c. Click here to copy the error into the clipboard.", - "shcopyerror $randomId", - false + onClick = { + copyError(randomId) + }, + prefix = false ) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt index 7e35d02b1..bd1077be4 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt @@ -68,7 +68,9 @@ object APIUtil { if (showApiErrors && apiName == "Hypixel API") { ChatUtils.clickableChat( "Problems with detecting the Hypixel API. §eClick here to hide this message for now.", - "shtogglehypixelapierrors" + onClick = { + toggleApiErrorMessages() + } ) } ErrorManager.logErrorWithData( diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt index b3861ce27..88d90c381 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ChatUtils.kt @@ -138,6 +138,7 @@ object ChatUtils { * * @see CHAT_PREFIX */ + //TODO rename to runHypixelCommand fun clickableChat(message: String, command: String, prefix: Boolean = true, prefixColor: String = "§e") { val msgPrefix = if (prefix) prefixColor + CHAT_PREFIX else "" val fullMessage = msgPrefix + message diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt index e37dda613..1ba5bc8fa 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TabListData.kt @@ -33,7 +33,7 @@ object TabListData { fun getHeader() = header fun getFooter() = footer - fun toggleDebugCommand() { + fun toggleDebug() { if (debugCache != null) { ChatUtils.chat("Disabled tab list debug.") debugCache = null @@ -48,7 +48,12 @@ object TabListData { fun copyCommand(args: Array<String>) { if (debugCache != null) { - ChatUtils.clickableChat("Tab list debug is enabled!", "shdebugtablist") + ChatUtils.clickableChat( + "Tab list debug is enabled!", + onClick = { + toggleDebug() + } + ) return } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt index 565a84eff..170efc84c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt @@ -50,15 +50,12 @@ open class SkyHanniTracker<Data : TrackerData>( fun isInventoryOpen() = inventoryOpen - fun resetCommand(args: Array<String>, command: String) { - if (args.size == 1 && args[0].lowercase() == "confirm") { - reset(DisplayMode.TOTAL, "Reset total $name!") - return - } - + fun resetCommand() { ChatUtils.clickableChat( "Are you sure you want to reset your total $name? Click here to confirm.", - "$command confirm" + onClick = { + reset(DisplayMode.TOTAL, "Reset total $name!") + } ) } |