aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/config
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-10-13 15:47:00 +0200
committerGitHub <noreply@github.com>2024-10-13 15:47:00 +0200
commit113389a86c769d4d3a547fac5b7440fa8f29bc6f (patch)
tree702537585f922d19a2cdfb94286c55568ccd21df /src/main/java/at/hannibal2/skyhanni/config
parentd8bb53773ba3f1e36e8822e58f3175c2847f7b61 (diff)
downloadskyhanni-113389a86c769d4d3a547fac5b7440fa8f29bc6f.tar.gz
skyhanni-113389a86c769d4d3a547fac5b7440fa8f29bc6f.tar.bz2
skyhanni-113389a86c769d4d3a547fac5b7440fa8f29bc6f.zip
Backend: Command Register Event (#2642)
Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Co-authored-by: Cal <cwolfson58@gmail.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/config')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/CommandBuilder.kt20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/CommandCategory.kt44
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt1297
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/RegisterCommandsEvent.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt45
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/garden/FarmingFortuneConfig.java4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java4
8 files changed, 806 insertions, 637 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt
index ffb3b7256..2aad75a40 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.config
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.GuiEditManager
import io.github.notenoughupdates.moulconfig.gui.GuiScreenElementWrapper
import io.github.notenoughupdates.moulconfig.gui.MoulConfigEditor
@@ -18,4 +19,16 @@ object ConfigGuiManager {
}
SkyHanniMod.screenToOpen = GuiScreenElementWrapper(editor)
}
+
+ fun onCommand(args: Array<String>) {
+ if (args.isNotEmpty()) {
+ if (args[0].lowercase() == "gui") {
+ GuiEditManager.openGuiPositionEditor(hotkeyReminder = true)
+ } else {
+ openConfigGui(args.joinToString(" "))
+ }
+ } else {
+ openConfigGui()
+ }
+ }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/CommandBuilder.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/CommandBuilder.kt
new file mode 100644
index 000000000..98227fc8c
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/CommandBuilder.kt
@@ -0,0 +1,20 @@
+package at.hannibal2.skyhanni.config.commands
+
+class CommandBuilder(val name: String) {
+ var description: String = ""
+ var category: CommandCategory = CommandCategory.MAIN
+ var aliases: List<String> = emptyList()
+ private var autoComplete: ((Array<String>) -> List<String>) = { listOf() }
+ private var callback: (Array<String>) -> Unit = {}
+
+ fun callback(callback: (Array<String>) -> Unit) {
+ this.callback = callback
+ }
+
+ fun autoComplete(autoComplete: (Array<String>) -> List<String>) {
+ this.autoComplete = autoComplete
+ }
+
+ fun toSimpleCommand() = SimpleCommand(name.lowercase(), aliases, callback, autoComplete)
+}
+
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/CommandCategory.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/CommandCategory.kt
new file mode 100644
index 000000000..b0474ae47
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/CommandCategory.kt
@@ -0,0 +1,44 @@
+package at.hannibal2.skyhanni.config.commands
+
+enum class CommandCategory(val color: String, val categoryName: String, val description: String) {
+ MAIN(
+ "§6",
+ "Main Command",
+ "Most useful commands of SkyHanni",
+ ),
+ USERS_ACTIVE(
+ "§e",
+ "Normal Command",
+ "Normal Command for everyone to use",
+ ),
+ USERS_RESET(
+ "§e",
+ "Normal Reset Command",
+ "Normal Command that resents some data",
+ ),
+ USERS_BUG_FIX(
+ "§f",
+ "User Bug Fix",
+ "A Command to fix small bugs",
+ ),
+ DEVELOPER_TEST(
+ "§5",
+ "Developer Test Commands",
+ "A Command to edit/test/change some features. §cIntended for developers only!",
+ ),
+ DEVELOPER_DEBUG(
+ "§9",
+ "Developer Debug Commands",
+ "A Command to debug/read/copy/monitor features. §cIntended for developers only!",
+ ),
+ INTERNAL(
+ "§8",
+ "Internal Command",
+ "A Command that should §cnever §7be called manually!",
+ ),
+ SHORTENED_COMMANDS(
+ "§b",
+ "Shortened Commands",
+ "Commands that shorten or improve existing Hypixel commands!",
+ )
+}
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 c5a28679e..208beafe4 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -2,12 +2,11 @@ package at.hannibal2.skyhanni.config.commands
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.api.SkillAPI
+import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.config.ConfigFileType
import at.hannibal2.skyhanni.config.ConfigGuiManager
-import at.hannibal2.skyhanni.config.features.About.UpdateStream
import at.hannibal2.skyhanni.data.ChatManager
import at.hannibal2.skyhanni.data.GardenCropMilestonesCommunityFix
-import at.hannibal2.skyhanni.data.GuiEditManager
import at.hannibal2.skyhanni.data.PartyAPI
import at.hannibal2.skyhanni.data.SackAPI
import at.hannibal2.skyhanni.data.ScoreboardData
@@ -80,6 +79,7 @@ import at.hannibal2.skyhanni.features.misc.visualwords.VisualWordGui
import at.hannibal2.skyhanni.features.rift.area.westvillage.VerminTracker
import at.hannibal2.skyhanni.features.rift.everywhere.PunchcardHighlight
import at.hannibal2.skyhanni.features.slayer.SlayerProfitTracker
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.DebugCommand
import at.hannibal2.skyhanni.test.PacketTest
import at.hannibal2.skyhanni.test.SkyBlockIslandTest
@@ -97,638 +97,735 @@ import at.hannibal2.skyhanni.test.command.TrackParticlesCommand
import at.hannibal2.skyhanni.test.command.TrackSoundsCommand
import at.hannibal2.skyhanni.test.graph.GraphEditor
import at.hannibal2.skyhanni.utils.APIUtils
-import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ExtendedChatColor
import at.hannibal2.skyhanni.utils.ItemPriceUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.TabListData
import at.hannibal2.skyhanni.utils.chat.ChatClickActionManager
import at.hannibal2.skyhanni.utils.repopatterns.RepoPatternGui
-import net.minecraft.command.ICommandSender
-import net.minecraft.util.BlockPos
-import net.minecraftforge.client.ClientCommandHandler
+@SkyHanniModule
object Commands {
- private val openMainMenu: (Array<String>) -> Unit = {
- if (it.isNotEmpty()) {
- if (it[0].lowercase() == "gui") {
- GuiEditManager.openGuiPositionEditor(hotkeyReminder = true)
- } else {
- ConfigGuiManager.openConfigGui(it.joinToString(" "))
- }
- } else {
- ConfigGuiManager.openConfigGui()
- }
- }
-
- // command -> description
- private val commands = mutableListOf<CommandInfo>()
-
- enum class CommandCategory(val color: String, val categoryName: String, val description: String) {
- MAIN("§6", "Main Command", "Most useful commands of SkyHanni"),
- USERS_NORMAL("§e", "Normal Command", "Normal Command for everyone to use"),
- USERS_BUG_FIX("§f", "User Bug Fix", "A Command to fix small bugs"),
- DEVELOPER_CODING_HELP(
- "§5",
- "Developer Coding Help",
- "A Command that can help with developing new features. §cIntended for developers only!",
- ),
- DEVELOPER_DEBUG_FEATURES(
- "§9",
- "Developer Debug Features",
- "A Command that is useful for monitoring/debugging existing features. §cIntended for developers only!",
- ),
- INTERNAL("§8", "Internal Command", "A Command that should §cnever §7be called manually!"),
- SHORTENED_COMMANDS("§b", "Shortened Commands", "Commands that shorten or improve existing Hypixel commands!")
- }
-
- class CommandInfo(val name: String, val description: String, val category: CommandCategory)
-
- private var currentCategory = CommandCategory.MAIN
-
- fun init() {
- currentCategory = CommandCategory.MAIN
- usersMain()
-
- currentCategory = CommandCategory.USERS_NORMAL
- usersNormal()
-
- currentCategory = CommandCategory.USERS_BUG_FIX
- usersBugFix()
-
- currentCategory = CommandCategory.DEVELOPER_CODING_HELP
- developersCodingHelp()
-
- currentCategory = CommandCategory.DEVELOPER_DEBUG_FEATURES
- developersDebugFeatures()
-
- currentCategory = CommandCategory.INTERNAL
- internalCommands()
-
- currentCategory = CommandCategory.SHORTENED_COMMANDS
- shortenedCommands()
- }
-
- private fun usersMain() {
- registerCommand("sh", "Opens the main SkyHanni config", openMainMenu)
- registerCommand("skyhanni", "Opens the main SkyHanni config", openMainMenu)
- registerCommand("ff", "Opens the Farming Fortune Guide") { openFortuneGuide() }
- registerCommand("shcommands", "Shows this list") { HelpCommand.onCommand(it, commands) }
- registerCommand0(
- "shdefaultoptions",
- "Select default options",
- { DefaultConfigFeatures.onCommand(it) },
- DefaultConfigFeatures::onComplete,
- )
- registerCommand("shremind", "Set a reminder for yourself") { ReminderManager.command(it) }
- registerCommand("shwords", "Opens the config list for modifying visual words") { openVisualWords() }
- registerCommand("shnavigate", "Using path finder to go to locatons") { NavigationHelper.onCommand(it) }
- }
-
- @Suppress("LongMethod")
- private fun usersNormal() {
- registerCommand(
- "shmarkplayer",
- "Add a highlight effect to a player for better visibility",
- ) { MarkedPlayerManager.command(it) }
- registerCommand("shtrackcollection", "Tracks your collection gain over time") { CollectionTracker.command(it) }
- registerCommand(
- "shcroptime",
- "Calculates with your current crop per second speed how long you need to farm a crop to collect this amount of items",
- ) { GardenCropTimeCommand.onCommand(it) }
- registerCommand(
- "shcropsin",
- "Calculates with your current crop per second how many items you can collect in this amount of time",
- ) { GardenCropsInCommand.onCommand(it) }
- registerCommand(
- "shrpcstart",
- "Manually starts the Discord Rich Presence feature",
- ) { DiscordRPCManager.startCommand() }
- registerCommand(
- "shcropstartlocation",
- "Manually sets the crop start location",
- ) { GardenStartLocation.setLocationCommand() }
- registerCommand(
- "shclearslayerprofits",
- "Clearing the total slayer profit for the current slayer type",
- ) { SlayerProfitTracker.clearProfitCommand(it) }
- registerCommand(
- "shimportghostcounterdata",
- "Manually importing the ghost counter data from GhostCounterV3",
- ) { GhostUtil.importCTGhostCounterData() }
- registerCommand(
- "shclearfarmingitems",
- "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() }
- registerCommand("shresetdicertracker", "Resets the Dicer Drop Tracker") { DicerRngDropTracker.resetCommand() }
- registerCommand("shresetcorpsetracker", "Resets the Glacite Mineshaft Corpse Tracker") { CorpseTracker.resetCommand() }
- registerCommand(
- "shresetendernodetracker",
- "Resets the Ender Node Tracker",
- ) { EnderNodeTracker.resetCommand() }
- registerCommand(
- "shresetarmordroptracker",
- "Resets the Armor Drop Tracker",
- ) { ArmorDropTracker.resetCommand() }
- registerCommand(
- "shresetfrozentreasuretracker",
- "Resets the Frozen Treasure Tracker",
- ) { FrozenTreasureTracker.resetCommand() }
- registerCommand(
- "shresetfishingtracker",
- "Resets the Fishing Profit Tracker",
- ) { FishingProfitTracker.resetCommand() }
- registerCommand(
- "shresetvisitordrops",
- "Reset the Visitors Drop Statistics",
- ) { GardenVisitorDropStatistics.resetCommand() }
- registerCommand("shbingotoggle", "Toggle the bingo card display mode") { BingoCardDisplay.toggleCommand() }
- registerCommand(
- "shfarmingprofile",
- "Look up the farming profile from yourself or another player on elitebot.dev",
- ) { FarmingWeightDisplay.lookUpCommand(it) }
- registerCommand(
- "shcopytranslation",
- "Copy the translation of a message in another language to your clipboard.\n" + "Uses a language code that can be found at the end of a translation message.",
- ) { Translator.fromNativeLanguage(it) }
- registerCommand(
- "shtranslate",
- "Translate a message in another language to your language.",
- ) { Translator.toNativeLanguage(it) }
- registerCommand(
- "shmouselock",
- "Lock/Unlock the mouse so it will no longer rotate the player (for farming)",
- ) { LockMouseLook.toggleLock() }
- registerCommand(
- "shsensreduce",
- "Lowers the mouse sensitivity for easier small adjustments (for farming)",
- ) { SensitivityReducer.manualToggle() }
- registerCommand(
- "shresetvermintracker",
- "Resets the Vermin Tracker",
- ) { VerminTracker.resetCommand() }
- registerCommand(
- "shresetdianaprofittracker",
- "Resets the Diana Profit Tracker",
- ) { DianaProfitTracker.resetCommand() }
- registerCommand(
- "shresetpestprofittracker",
- "Resets the Pest Profit Tracker",
- ) { PestProfitTracker.resetCommand() }
- registerCommand(
- "shresetexperimentsprofittracker",
- "Resets the Experiments Profit Tracker",
- ) { ExperimentsProfitTracker.resetCommand() }
- registerCommand(
- "shresetmythologicalcreaturetracker",
- "Resets the Mythological Creature Tracker",
- ) { MythologicalCreatureTracker.resetCommand() }
- registerCommand(
- "shresetseacreaturetracker",
- "Resets the Sea Creature Tracker",
- ) { SeaCreatureTracker.resetCommand() }
- registerCommand(
- "shresetstrayrabbittracker",
- "Resets the Stray Rabbit Tracker",
- ) { ChocolateFactoryStrayTracker.resetCommand() }
- registerCommand(
- "shresetexcavatortracker",
- "Resets the Fossil Excavator Profit Tracker",
- ) { ExcavatorProfitTracker.resetCommand() }
- registerCommand(
- "shfandomwiki",
- "Searches the fandom wiki with SkyHanni's own method.",
- ) { WikiManager.otherWikiCommands(it, true) }
- registerCommand(
- "shfandomwikithis",
- "Searches the fandom wiki with SkyHanni's own method.",
- ) { WikiManager.otherWikiCommands(it, true, true) }
- registerCommand(
- "shofficialwiki",
- "Searches the official wiki with SkyHanni's own method.",
- ) { WikiManager.otherWikiCommands(it, false) }
- registerCommand(
- "shofficialwikithis",
- "Searches the official wiki with SkyHanni's own method.",
- ) { WikiManager.otherWikiCommands(it, false, true) }
- registerCommand0(
- "shcalccrop",
- "Calculate how many crops need to be farmed between different crop milestones.",
- {
- FarmingMilestoneCommand.onCommand(it.getOrNull(0), it.getOrNull(1), it.getOrNull(2), false)
- },
- FarmingMilestoneCommand::onComplete,
- )
- registerCommand0(
- "shcalccroptime",
- "Calculate how long you need to farm crops between different crop milestones.",
- {
- FarmingMilestoneCommand.onCommand(it.getOrNull(0), it.getOrNull(1), it.getOrNull(2), true)
- },
- FarmingMilestoneCommand::onComplete,
- )
- registerCommand0(
- "shcropgoal",
- "Define a custom milestone goal for a crop.",
- { FarmingMilestoneCommand.setGoal(it) },
- FarmingMilestoneCommand::onComplete,
- )
- registerCommand0(
- "shskills",
- "Skills XP/Level related command",
- { SkillAPI.onCommand(it) },
- SkillAPI::onComplete,
- )
- registerCommand(
- "shlimbostats",
- "Prints your Limbo Stats.\n §7This includes your Personal Best, Playtime, and §aSkyHanni User Luck§7!",
- ) { LimboTimeTracker.printStats() }
- registerCommand(
- "shlanedetection",
- "Detect a farming lane in the Garden",
- ) { FarmingLaneCreator.commandLaneDetection() }
- registerCommand(
- "shignore",
- "Add/Remove a user from your",
- ) { PartyChatCommands.blacklist(it) }
- registerCommand(
- "shtpinfested",
- "Teleports you to the nearest infested plot",
- ) { PestFinder.teleportNearestInfestedPlot() }
- registerCommand(
- "shhoppitystats",
- "Look up stats for a Hoppity's Event (by SkyBlock year).\nRun standalone for a list of years that have stats.",
- ) { HoppityEventSummary.sendStatsMessage(it) }
- registerCommand(
- "shcolors",
- "Prints a list of all Minecraft color & formatting codes in chat.",
- ) { ColorFormattingHelper.printColorCodeList() }
- registerCommand(
- "shtps",
- "Informs in chat about the server ticks per second (TPS).",
- ) { TpsCounter.tpsCommand() }
- registerCommand(
- "shcarry",
- "Keep track of carries you do.",
- ) { CarryTracker.onCommand(it) }
- }
+ val commands = mutableListOf<CommandBuilder>()
- private fun usersBugFix() {
- registerCommand("shupdaterepo", "Download the SkyHanni repo again") { SkyHanniMod.repo.updateRepo() }
- registerCommand(
- "shresetburrowwarps",
- "Manually resetting disabled diana burrow warp points",
- ) { BurrowWarpHelper.resetDisabledWarps() }
- registerCommand(
- "shtogglehypixelapierrors",
- "Show/hide hypixel api error messages in chat",
- ) { APIUtils.toggleApiErrorMessages() }
- registerCommand(
- "shclearcropspeed",
- "Reset garden crop speed data and best crop time data",
- ) { GardenAPI.clearCropSpeed() }
- registerCommand(
- "shclearminiondata",
- "Removed bugged minion locations from your private island",
- ) { MinionFeatures.removeBuggedMinions(isCommand = true) }
- registerCommand(
- "shwhereami",
- "Print current island in chat",
- ) { SkyHanniDebugsAndTests.whereAmI() }
- registerCommand(
- "shclearcontestdata",
- "Resets Jacob's Contest Data",
- ) { SkyHanniDebugsAndTests.clearContestData() }
- registerCommand(
- "shconfig",
- "Search or reset config elements §c(warning, dangerous!)",
- ) { SkyHanniConfigSearchResetCommand.command(it) }
- registerCommand(
- "shdebug",
- "Copies SkyHanni debug data in the clipboard.",
- ) { DebugCommand.command(it) }
- registerCommand(
- "shversion",
- "Prints the SkyHanni version in the chat",
- ) { SkyHanniDebugsAndTests.debugVersion() }
- registerCommand(
- "shrendertoggle",
- "Disables/enables the rendering of all skyhanni guis.",
- ) { SkyHanniDebugsAndTests.toggleRender() }
- registerCommand(
- "shcarrolyn",
- "Toggles if the specified crops effect is active from carrolyn",
- ) {
- CaptureFarmingGear.handelCarrolyn(it)
- }
- registerCommand(
- "shrepostatus",
- "Shows the status of all the mods constants",
- ) { SkyHanniMod.repo.displayRepoStatus(false) }
- registerCommand(
- "shclearkismet",
- "Clears the saved values of the applied kismet feathers in Croesus",
- ) { CroesusChestTracker.resetChest() }
- registerCommand(
- "shkingfix",
- "Resets the local King Talisman Helper offset.",
- ) { KingTalismanHelper.kingFix() }
- registerCommand(
- "shupdate",
- "Updates the mod to the specified update stream.",
- ) { forceUpdate(it) }
- registerCommand(
- "shUpdateBazaarPrices",
- "Forcefully updating the bazaar prices right now.",
- ) { HypixelBazaarFetcher.fetchNow() }
- registerCommand(
- "shclearsavedrabbits",
- "Clears the saved rabbits on this profile.",
- ) { HoppityCollectionStats.clearSavedRabbits() }
- registerCommand(
- "shresetpunchcard",
- "Resets the Rift Punchcard Artifact player list.",
- ) { PunchcardHighlight.clearList() }
- registerCommand(
- "shedittracker",
- "Changes the tracked item amount for Diana, Fishing, Pest, Excavator, and Slayer Item Trackers.",
- ) { TrackerManager.commandEditTracker(it) }
+ @HandleEvent
+ fun registerCommands(event: RegisterCommandsEvent) {
+ usersMain(event)
+ usersNormal(event)
+ usersNormalReset(event)
+ usersBugFix(event)
+ devTest(event)
+ devDebug(event)
+ internalCommands(event)
+ shortenedCommands(event)
}
- private fun developersDebugFeatures() {
- registerCommand("shtestbingo", "dev command") { TestBingo.toggle() }
- registerCommand("shprintbingohelper", "dev command") { BingoNextStepHelper.command() }
- registerCommand("shreloadbingodata", "dev command") { BingoCardDisplay.command() }
- registerCommand("shtestgardenvisitors", "dev command") { SkyHanniDebugsAndTests.testGardenVisitors() }
- registerCommand("shtestcomposter", "dev command") { ComposterOverlay.onCommand(it) }
- registerCommand("shtestinquisitor", "dev command") { InquisitorWaypointShare.test() }
- registerCommand("shshowcropmoneycalculation", "dev command") { CropMoneyDisplay.toggleShowCalculation() }
- registerCommand("shcropspeedmeter", "Debugs how many crops you collect over time") { CropSpeedMeter.toggle() }
- registerCommand0(
- "shworldedit",
- "Select regions in the world",
- { WorldEdit.command(it) },
- { listOf("copy", "reset", "help", "left", "right") },
- )
- registerCommand(
- "shconfigsave",
- "Manually saving the config",
- ) { SkyHanniMod.configManager.saveConfig(ConfigFileType.FEATURES, "manual-command") }
- registerCommand(
- "shtestburrow",
- "Sets a test burrow waypoint at your location",
- ) { GriffinBurrowHelper.setTestBurrow(it) }
- registerCommand(
- "shtestsackapi",
- "Get the amount of an item in sacks according to internal feature SackAPI",
- ) { SackAPI.testSackAPI(it) }
- registerCommand(
- "shtestgriffinspots",
- "Show potential griffin spots around you.",
- ) { GriffinBurrowHelper.testGriffinSpots() }
- registerCommand(
- "shtestisland",
- "Sets the current skyblock island for testing purposes.",
- ) { SkyBlockIslandTest.onCommand(it) }
- registerCommand(
- "shdebugprice",
- "Debug different price sources for an item.",
- ) { ItemPriceUtils.debugItemPrice(it) }
- registerCommand(
- "shdebugscoreboard",
- "Monitors the scoreboard changes: Prints the raw scoreboard lines in the console after each update, with time since last update.",
- ) { ScoreboardData.toggleMonitor() }
- registerCommand(
- "shresetterminal",
- "Resets terminal highlights in F7.",
- ) { TerminalInfo.resetTerminals() }
+ private fun usersMain(event: RegisterCommandsEvent) {
+ event.register("sh") {
+ aliases = listOf("skyhanni")
+ description = "Opens the main SkyHanni config"
+ callback { ConfigGuiManager.onCommand(it) }
+ }
+ event.register("ff") {
+ description = "Opens the Farming Fortune Guide"
+ callback { FFGuideGUI.onCommand() }
+ }
+ event.register("shcommands") {
+ description = "Shows this list"
+ callback { HelpCommand.onCommand(it) }
+ }
+ event.register("shdefaultoptions") {
+ description = "Select default options"
+ callback { DefaultConfigFeatures.onCommand(it) }
+ autoComplete { DefaultConfigFeatures.onComplete(it) }
+ }
+ event.register("shremind") {
+ description = "Set a reminder for yourself"
+ callback { ReminderManager.command(it) }
+ }
+ event.register("shwords") {
+ description = "Opens the config list for modifying visual words"
+ callback { VisualWordGui.onCommand() }
+ }
+ event.register("shnavigate") {
+ 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) }
+ }
+ event.register("shtrackcollection") {
+ description = "Tracks your collection gain over time"
+ callback { CollectionTracker.command(it) }
+ }
}
@Suppress("LongMethod")
- private fun developersCodingHelp() {
- registerCommand("shrepopatterns", "See where regexes are loaded from") { RepoPatternGui.open() }
- registerCommand("shtest", "Unused test command.") { SkyHanniDebugsAndTests.testCommand(it) }
- registerCommand("shtestrabbitpaths", "Tests pathfinding to rabbit eggs. Use a number 0-14.") {
- HoppityEggLocator.testPathfind(it)
- }
- registerCommand(
- "shtestitem",
- "test item internal name resolving",
- ) { SkyHanniDebugsAndTests.testItemCommand(it) }
- registerCommand(
- "shfindnullconfig",
- "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.toggleDebug() }
- registerCommand("shreloadlocalrepo", "Reloading the local repo data") { SkyHanniMod.repo.reloadLocalRepo() }
- registerCommand("shchathistory", "Show the unfiltered chat history") { ChatManager.openChatFilterGUI(it) }
- registerCommand(
- "shstoplisteners",
- "Unregistering all loaded forge event listeners",
- ) { SkyHanniDebugsAndTests.stopListeners() }
- registerCommand(
- "shreloadlisteners",
- "Trying to load all forge event listeners again. Might not work at all",
- ) { SkyHanniDebugsAndTests.reloadListeners() }
- registerCommand(
- "shcopylocation",
- "Copies the player location as LorenzVec format to the clipboard",
- ) { SkyHanniDebugsAndTests.copyLocation(it) }
- registerCommand(
- "shcopyentities",
- "Copies entities in the specified radius around the player to the clipboard",
- ) { CopyNearbyEntitiesCommand.command(it) }
- registerCommand(
- "shtracksounds",
- "Tracks the sounds for the specified duration (in seconds) and copies it to the clipboard",
- ) { TrackSoundsCommand.command(it) }
- registerCommand(
- "shtrackparticles",
- "Tracks the particles for the specified duration (in seconds) and copies it to the clipboard",
- ) { TrackParticlesCommand.command(it) }
- registerCommand(
- "shcopytablist",
- "Copies the tab list data to the clipboard",
- ) { TabListData.copyCommand(it) }
- registerCommand(
- "shcopyactionbar",
- "Copies the action bar to the clipboard, including formatting codes",
- ) { CopyActionBarCommand.command(it) }
- registerCommand(
- "shcopyscoreboard",
- "Copies the scoreboard data to the clipboard",
- ) { CopyScoreboardCommand.command(it) }
- registerCommand(
- "shcopybossbar",
- "Copies the name of the bossbar to the clipboard, including formatting codes",
- ) { CopyBossbarCommand.command(it) }
- registerCommand(
- "shcopyitem",
- "Copies information about the item in hand to the clipboard",
- ) { CopyItemCommand.command() }
- registerCommand("shtestpacket", "Logs incoming and outgoing packets to the console") { PacketTest.command(it) }
- registerCommand(
- "shtestmessage",
- "Sends a custom chat message client side in the chat",
- ) { TestChatCommand.command(it) }
- registerCommand(
- "shtestrainbow",
- "Sends a rainbow in chat",
- ) { ExtendedChatColor.testCommand() }
- registerCommand(
- "shcopyinternalname",
- "Copies the internal name of the item in hand to the clipboard.",
- ) { SkyHanniDebugsAndTests.copyItemInternalName() }
- registerCommand(
- "shpartydebug",
- "List persons into the chat SkyHanni thinks are in your party.",
- ) { PartyAPI.listMembers() }
- registerCommand(
- "shplaysound",
- "Play the specified sound effect at the given pitch and volume.",
- ) { SoundUtils.command(it) }
- registerCommand(
- "shsendtitle",
- "Display a title on the screen with the specified settings.",
- ) { TitleManager.command(it) }
- registerCommand(
- "shresetconfig",
- "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.resetConfigCommand() }
- registerCommand(
- "shreadcropmilestonefromclipboard",
- "Read crop milestone from clipboard. This helps fixing wrong crop milestone data",
- ) { GardenCropMilestonesCommunityFix.readDataFromClipboard() }
- registerCommand(
- "shcopyfoundburrowlocations",
- "Copy all ever found burrow locations to clipboard",
- ) { AllBurrowsList.copyToClipboard() }
- registerCommand(
- "shaddfoundburrowlocationsfromclipboard",
- "Add all ever found burrow locations from clipboard",
- ) { AllBurrowsList.addFromClipboard() }
- registerCommand(
- "shgraph",
- "Enables the graph editor",
- ) { GraphEditor.commandIn() }
- registerCommand(
- "shtoggleegglocationdebug",
- "Shows Hoppity egg locations with their internal API names and status.",
- ) { HoppityEggLocations.toggleDebug() }
- registerCommand(
- "shresetmineshaftpitystats",
- "Resets the mineshaft pity display stats",
- ) { MineshaftPityDisplay.fullResetCounter() }
- registerCommand(
- "shtranslateadvanced",
- "Translates a message in an inputted language to another inputted language.",
- ) { Translator.translateAdvancedCommand(it) }
- }
-
- private fun internalCommands() {
- registerCommand("shaction", "") { ChatClickActionManager.onCommand(it) }
+ private fun usersNormal(event: RegisterCommandsEvent) {
+ event.register("shimportghostcounterdata") {
+ description = "Manually importing the ghost counter data from GhostCounterV3"
+ category = CommandCategory.USERS_ACTIVE
+ callback { GhostUtil.importCTGhostCounterData() }
+ }
+ event.register("shcroptime") {
+ description = "Calculates with your current crop per second speed " +
+ "how long you need to farm a crop to collect this amount of items"
+ category = CommandCategory.USERS_ACTIVE
+ callback { GardenCropTimeCommand.onCommand(it) }
+ }
+ event.register("shcropsin") {
+ description = "Calculates with your current crop per second how many items you can collect in this amount of time"
+ category = CommandCategory.USERS_ACTIVE
+ callback { GardenCropsInCommand.onCommand(it) }
+ }
+ event.register("shrpcstart") {
+ description = "Manually starts the Discord Rich Presence feature"
+ category = CommandCategory.USERS_ACTIVE
+ callback { DiscordRPCManager.startCommand() }
+ }
+ event.register("shcropstartlocation") {
+ description = "Manually sets the crop start location"
+ category = CommandCategory.USERS_ACTIVE
+ callback { GardenStartLocation.setLocationCommand() }
+ }
+ event.register("shbingotoggle") {
+ description = "Toggle the bingo card display mode"
+ category = CommandCategory.USERS_ACTIVE
+ callback { BingoCardDisplay.toggleCommand() }
+ }
+ event.register("shfarmingprofile") {
+ description = "Look up the farming profile from yourself or another player on elitebot.dev"
+ category = CommandCategory.USERS_ACTIVE
+ callback { FarmingWeightDisplay.lookUpCommand(it) }
+ }
+ event.register("shcopytranslation") {
+ description = "Copy the translation of a message in another language to your clipboard.\n" +
+ "Uses a language code that can be found at the end of a translation message."
+ category = CommandCategory.USERS_ACTIVE
+ callback { Translator.fromNativeLanguage(it) }
+ }
+ event.register("shtranslate") {
+ description = "Translate a message in another language your language."
+ category = CommandCategory.USERS_ACTIVE
+ callback { Translator.toNativeLanguage(it) }
+ }
+ event.register("shmouselock") {
+ description = "Lock/Unlock the mouse so it will no longer rotate the player (for farming)"
+ category = CommandCategory.USERS_ACTIVE
+ callback { LockMouseLook.toggleLock() }
+ }
+ event.register("shsensreduce") {
+ description = "Lowers the mouse sensitivity for easier small adjustments (for farming)"
+ category = CommandCategory.USERS_ACTIVE
+ callback { SensitivityReducer.manualToggle() }
+ }
+ event.register("shfandomwiki") {
+ description = "Searches the fandom wiki with SkyHanni's own method."
+ category = CommandCategory.USERS_ACTIVE
+ callback { WikiManager.otherWikiCommands(it, true) }
+ }
+ event.register("shfandomwikithis") {
+ description = "Searches the fandom wiki with SkyHanni's own method."
+ category = CommandCategory.USERS_ACTIVE
+ callback { WikiManager.otherWikiCommands(it, true, true) }
+ }
+ event.register("shofficialwiki") {
+ description = "Searches the official wiki with SkyHanni's own method."
+ category = CommandCategory.USERS_ACTIVE
+ callback { WikiManager.otherWikiCommands(it, false) }
+ }
+ event.register("shofficialwikithis") {
+ description = "Searches the official wiki with SkyHanni's own method."
+ category = CommandCategory.USERS_ACTIVE
+ callback { WikiManager.otherWikiCommands(it, false, true) }
+ }
+ event.register("shcalccrop") {
+ description = "Calculate how many crops need to be farmed between different crop milestones."
+ category = CommandCategory.USERS_ACTIVE
+ autoComplete { FarmingMilestoneCommand.onComplete(it) }
+ callback { FarmingMilestoneCommand.onCommand(it.getOrNull(0), it.getOrNull(1), it.getOrNull(2), false) }
+ }
+ event.register("shcalccroptime") {
+ description = "Calculate how long you need to farm crops between different crop milestones."
+ category = CommandCategory.USERS_ACTIVE
+ autoComplete { FarmingMilestoneCommand.onComplete(it) }
+ callback { FarmingMilestoneCommand.onCommand(it.getOrNull(0), it.getOrNull(1), it.getOrNull(2), true) }
+ }
+ event.register("shcropgoal") {
+ description = "Define a custom milestone goal for a crop."
+ category = CommandCategory.USERS_ACTIVE
+ callback { FarmingMilestoneCommand.setGoal(it) }
+ autoComplete { FarmingMilestoneCommand.onComplete(it) }
+ }
+ event.register("shskills") {
+ description = "Skills XP/Level related command"
+ category = CommandCategory.USERS_ACTIVE
+ callback { SkillAPI.onCommand(it) }
+ autoComplete { SkillAPI.onComplete(it) }
+ }
+ event.register("shlimbostats") {
+ description = "Prints your Limbo Stats.\n §7This includes your Personal Best, Playtime, and §aSkyHanni User Luck§7!"
+ category = CommandCategory.USERS_ACTIVE
+ callback { LimboTimeTracker.printStats() }
+ }
+ event.register("shlanedetection") {
+ description = "Detect a farming lane in the Garden"
+ category = CommandCategory.USERS_ACTIVE
+ callback { FarmingLaneCreator.commandLaneDetection() }
+ }
+ event.register("shignore") {
+ description = "Add/Remove a user from your blacklist"
+ category = CommandCategory.USERS_ACTIVE
+ callback { PartyChatCommands.blacklist(it) }
+ }
+ event.register("shtpinfested") {
+ description = "Teleports you to the nearest infested plot"
+ category = CommandCategory.USERS_ACTIVE
+ callback { PestFinder.teleportNearestInfestedPlot() }
+ }
+ event.register("shhoppitystats") {
+ description = "Look up stats for a Hoppity's Event (by SkyBlock year).\nRun standalone for a list of years that have stats."
+ category = CommandCategory.USERS_ACTIVE
+ callback { HoppityEventSummary.sendStatsMessage(it) }
+ }
+ event.register("shcolors") {
+ description = "Prints a list of all Minecraft color & formatting codes in chat."
+ category = CommandCategory.USERS_ACTIVE
+ aliases = listOf("shcolor", "shcolours", "shcolour")
+ callback { ColorFormattingHelper.printColorCodeList() }
+ }
+ event.register("shtps") {
+ description = "Informs in chat about the server ticks per second (TPS)."
+ category = CommandCategory.USERS_ACTIVE
+ callback { TpsCounter.tpsCommand() }
+ }
}
- private fun shortenedCommands() {
- registerCommand("pko", "Kicks offline party members") { PartyCommands.kickOffline() }
- registerCommand("pw", "Warps your party") { PartyCommands.warp() }
- registerCommand("pk", "Kick a specific party member") { PartyCommands.kick(it) }
- registerCommand("pt", "Transfer the party to another party member") { PartyCommands.transfer(it) }
- registerCommand("pp", "Promote a specific party member") { PartyCommands.promote(it) }
- registerCommand("pd", "Disbands the party") { PartyCommands.disband() }
- registerCommand("rpt", "Reverse transfer party to the previous leader") { PartyCommands.reverseTransfer() }
- }
+ private fun usersNormalReset(event: RegisterCommandsEvent) {
- @JvmStatic
- fun openFortuneGuide() {
- if (!LorenzUtils.inSkyBlock) {
- ChatUtils.userError("Join SkyBlock to open the fortune guide!")
- } else {
- FFGuideGUI.open()
+ // Trackers
+ event.register("shresetslayerprofits") {
+ description = "Resets the total slayer profit for the current slayer type"
+ category = CommandCategory.USERS_RESET
+ callback { SlayerProfitTracker.resetCommand() }
+ }
+ event.register("shresetpowdertracker") {
+ description = "Resets the Powder Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { PowderTracker.resetCommand() }
+ }
+ event.register("shresetdicertracker") {
+ description = "Resets the Dicer Drop Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { DicerRngDropTracker.resetCommand() }
+ }
+ event.register("shresetcorpsetracker") {
+ description = "Resets the Glacite Mineshaft Corpse Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { CorpseTracker.resetCommand() }
+ }
+ event.register("shresetendernodetracker") {
+ description = "Resets the Ender Node Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { EnderNodeTracker.resetCommand() }
+ }
+ event.register("shresetarmordroptracker") {
+ description = "Resets the Armor Drop Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { ArmorDropTracker.resetCommand() }
+ }
+ event.register("shresetfrozentreasuretracker") {
+ description = "Resets the Frozen Treasure Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { FrozenTreasureTracker.resetCommand() }
+ }
+ event.register("shresetfishingtracker") {
+ description = "Resets the Fishing Profit Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { FishingProfitTracker.resetCommand() }
+ }
+ event.register("shresetvisitordrops") {
+ description = "Resets the Visitors Drop Statistics"
+ category = CommandCategory.USERS_RESET
+ callback { GardenVisitorDropStatistics.resetCommand() }
+ }
+ event.register("shresetvermintracker") {
+ description = "Resets the Vermin Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { VerminTracker.resetCommand() }
+ }
+ event.register("shresetdianaprofittracker") {
+ description = "Resets the Diana Profit Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { DianaProfitTracker.resetCommand() }
+ }
+ event.register("shresetpestprofittracker") {
+ description = "Resets the Pest Profit Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { PestProfitTracker.resetCommand() }
+ }
+ event.register("shresetexperimentsprofittracker") {
+ description = "Resets the Experiments Profit Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { ExperimentsProfitTracker.resetCommand() }
+ }
+ event.register("shresetmythologicalcreaturetracker") {
+ description = "Resets the Mythological Creature Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { MythologicalCreatureTracker.resetCommand() }
+ }
+ event.register("shresetseacreaturetracker") {
+ description = "Resets the Sea Creature Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { SeaCreatureTracker.resetCommand() }
+ }
+ event.register("shresetstrayrabbittracker") {
+ description = "Resets the Stray Rabbit Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { ChocolateFactoryStrayTracker.resetCommand() }
+ }
+ event.register("shresetexcavatortracker") {
+ description = "Resets the Fossil Excavator Profit Tracker"
+ category = CommandCategory.USERS_RESET
+ callback { ExcavatorProfitTracker.resetCommand() }
}
- }
- @JvmStatic
- fun openVisualWords() {
- if (!LorenzUtils.onHypixel) {
- ChatUtils.userError("You need to join Hypixel to use this feature!")
- } else {
- if (VisualWordGui.sbeConfigPath.exists()) VisualWordGui.drawImport = true
- SkyHanniMod.screenToOpen = VisualWordGui()
+ // non trackers
+ event.register("shresetghostcounter") {
+ description = "Resets the ghost counter"
+ category = CommandCategory.USERS_RESET
+ callback { GhostUtil.reset() }
+ }
+ event.register("shresetcropspeed") {
+ description = "Resets garden crop speed data and best crop time data"
+ category = CommandCategory.USERS_RESET
+ callback { GardenAPI.resetCropSpeed() }
+ }
+ event.register("shresetkismet") {
+ description = "Resets the saved values of the applied kismet feathers in Croesus"
+ category = CommandCategory.USERS_RESET
+ callback { CroesusChestTracker.resetChest() }
+ }
+ event.register("shresetburrowwarps") {
+ description = "Manually resetting disabled diana burrow warp points"
+ category = CommandCategory.USERS_RESET
+ callback { BurrowWarpHelper.resetDisabledWarps() }
+ }
+ event.register("shresetcontestdata") {
+ description = "Resets Jacob's Contest Data"
+ category = CommandCategory.USERS_RESET
+ callback { SkyHanniDebugsAndTests.resetContestData() }
+ }
+ event.register("shresetfarmingitems") {
+ description = "Resets farming items saved for the Farming Fortune Guide"
+ category = CommandCategory.USERS_RESET
+ callback { CaptureFarmingGear.onResetGearCommand() }
+ }
+ event.register("shresetmineshaftpitystats") {
+ description = "Resets the mineshaft pity display stats"
+ category = CommandCategory.USERS_RESET
+ callback { MineshaftPityDisplay.fullResetCounter() }
+ }
+ event.register("shresetterminal") {
+ description = "Resets terminal highlights in F7."
+ category = CommandCategory.USERS_RESET
+ callback { TerminalInfo.resetTerminals() }
+ }
+ event.register("shresetsavedrabbits") {
+ description = "Resets the saved rabbits on this profile."
+ category = CommandCategory.USERS_RESET
+ callback { HoppityCollectionStats.resetSavedRabbits() }
+ }
+ event.register("shresetpunchcard") {
+ description = "Resets the Rift Punchcard Artifact player list."
+ category = CommandCategory.USERS_RESET
+ callback { PunchcardHighlight.onResetCommand() }
}
}
- private fun clearFarmingItems() {
- val storage = GardenAPI.storage?.fortune ?: return
- ChatUtils.chat("clearing farming items")
- storage.farmingItems.clear()
- storage.outdatedItems.clear()
+ private fun usersBugFix(event: RegisterCommandsEvent) {
+ event.register("shupdaterepo") {
+ description = "Download the SkyHanni repo again"
+ category = CommandCategory.USERS_BUG_FIX
+ callback { SkyHanniMod.repo.updateRepo() }
+ }
+ event.register("shtogglehypixelapierrors") {
+ description = "Show/hide hypixel api error messages in chat"
+ category = CommandCategory.USERS_BUG_FIX
+ callback { APIUtils.toggleApiErrorMessages() }
+ }
+ event.register("shfixminions") {
+ description = "Removed bugged minion locations from your private island"
+ category = CommandCategory.USERS_BUG_FIX
+ callback { MinionFeatures.removeBuggedMinions(isCommand = true) }
+ }
+ event.register("shwhereami") {
+ description = "Print current island in chat"
+ category = CommandCategory.USERS_BUG_FIX
+ callback { SkyHanniDebugsAndTests.whereAmI() }
+ }
+ event.register("shrendertoggle") {
+ description = "Disables/enables the rendering of all skyhanni guis."
+ category = CommandCategory.USERS_BUG_FIX
+ callback { SkyHanniDebugsAndTests.toggleRender() }
+ }
+ event.register("shcarrolyn") {
+ description = "Toggles if the specified crops effect is active from carrolyn"
+ category = CommandCategory.USERS_BUG_FIX
+ callback { CaptureFarmingGear.handelCarrolyn(it) }
+ }
+ event.register("shrepostatus") {
+ description = "Shows the status of all the mods constants"
+ category = CommandCategory.USERS_BUG_FIX
+ callback { SkyHanniMod.repo.displayRepoStatus(false) }
+ }
+ event.register("shkingfix") {
+ description = "Resets the local King Talisman Helper offset."
+ category = CommandCategory.USERS_BUG_FIX
+ callback { KingTalismanHelper.kingFix() }
+ }
+ event.register("shupdate") {
+ description = "Updates the mod to the specified update stream."
+ category = CommandCategory.USERS_BUG_FIX
+ callback { UpdateManager.updateCommand(it) }
+ }
+ event.register("shupdatebazaarprices") {
+ description = "Forcefully updating the bazaar prices right now."
+ category = CommandCategory.USERS_BUG_FIX
+ callback { HypixelBazaarFetcher.fetchNow() }
+ }
+ event.register("shedittracker") {
+ description = "Changes the tracked item amount for Diana, Fishing, Pest, Excavator, and Slayer Item Trackers."
+ category = CommandCategory.USERS_BUG_FIX
+ callback { TrackerManager.commandEditTracker(it) }
+ }
}
- private fun forceUpdate(args: Array<String>) {
- val currentStream = SkyHanniMod.feature.about.updateStream.get()
- val arg = args.firstOrNull() ?: "current"
- val updateStream = when {
- arg.equals("(?i)(?:full|release)s?".toRegex()) -> UpdateStream.RELEASES
- arg.equals("(?i)(?:beta|latest)s?".toRegex()) -> UpdateStream.BETA
- else -> currentStream
+ private fun devDebug(event: RegisterCommandsEvent) {
+ event.register("shdebug") {
+ description = "Copies SkyHanni debug data in the clipboard."
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { DebugCommand.command(it) }
}
-
- val switchingToBeta = updateStream == UpdateStream.BETA && (currentStream != UpdateStream.BETA || !UpdateManager.isCurrentlyBeta())
- if (switchingToBeta) {
- ChatUtils.clickableChat(
- "Are you sure you want to switch to beta? These versions may be less stable.",
- onClick = {
- UpdateManager.checkUpdate(true, updateStream)
- },
- "§eClick to confirm!",
- oneTimeClick = true,
- )
- } else {
- UpdateManager.checkUpdate(true, updateStream)
+ event.register("shconfig") {
+ description = "Searches or resets config elements §c(warning, dangerous!)"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { SkyHanniConfigSearchResetCommand.command(it) }
+ }
+ event.register("shversion") {
+ description = "Prints the SkyHanni version in the chat"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { SkyHanniDebugsAndTests.debugVersion() }
+ }
+ event.register("shtestbingo") {
+ description = "Toggle the test bingo card display mode"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { TestBingo.toggle() }
+ }
+ event.register("shprintbingohelper") {
+ description = "Prints the next step helper for the bingo card"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { BingoNextStepHelper.command() }
+ }
+ event.register("shreloadbingodata") {
+ description = "Reloads the bingo card data"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { BingoCardDisplay.command() }
+ }
+ event.register("shtestgardenvisitors") {
+ description = "Test the garden visitor drop statistics"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { SkyHanniDebugsAndTests.testGardenVisitors() }
+ }
+ event.register("shtestcomposter") {
+ description = "Test the composter overlay"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { ComposterOverlay.onCommand(it) }
+ }
+ event.register("shtestinquisitor") {
+ description = "Test the inquisitor waypoint share"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { InquisitorWaypointShare.test() }
+ }
+ event.register("shshowcropmoneycalculation") {
+ description = "Show the calculation of the crop money"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { CropMoneyDisplay.toggleShowCalculation() }
+ }
+ event.register("shcropspeedmeter") {
+ description = "Debugs how many crops you collect over time"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { CropSpeedMeter.toggle() }
+ }
+ event.register("shworldedit") {
+ description = "Select regions in the world"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { WorldEdit.command(it) }
+ autoComplete { listOf("copy", "reset", "help", "left", "right") }
+ }
+ event.register("shtestsackapi") {
+ description = "Get the amount of an item in sacks according to internal feature SackAPI"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { SackAPI.testSackAPI(it) }
+ }
+ event.register("shtestgriffinspots") {
+ description = "Show potential griffin spots around you."
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { GriffinBurrowHelper.testGriffinSpots() }
+ }
+ event.register("shdebugprice") {
+ description = "Debug different price sources for an item."
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { ItemPriceUtils.debugItemPrice(it) }
+ }
+ event.register("shdebugscoreboard") {
+ description = "Monitors the scoreboard changes: " +
+ "Prints the raw scoreboard lines in the console after each update, with time since last update."
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { ScoreboardData.toggleMonitor() }
+ }
+ event.register("shcopyinternalname") {
+ description = "Copies the internal name of the item in hand to the clipboard."
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { SkyHanniDebugsAndTests.copyItemInternalName() }
+ }
+ event.register("shcopylocation") {
+ description = "Copies the player location as LorenzVec format to the clipboard"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { SkyHanniDebugsAndTests.copyLocation(it) }
+ }
+ event.register("shcopyentities") {
+ description = "Copies entities in the specified radius around the player to the clipboard"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { CopyNearbyEntitiesCommand.command(it) }
+ }
+ event.register("shcopytablist") {
+ description = "Copies the tab list data to the clipboard"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { TabListData.copyCommand(it) }
+ }
+ event.register("shcopyactionbar") {
+ description = "Copies the action bar to the clipboard, including formatting codes"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { CopyActionBarCommand.command(it) }
+ }
+ event.register("shcopyscoreboard") {
+ description = "Copies the scoreboard data to the clipboard"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { CopyScoreboardCommand.command(it) }
+ }
+ event.register("shcopybossbar") {
+ description = "Copies the name of the bossbar to the clipboard, including formatting codes"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { CopyBossbarCommand.command(it) }
+ }
+ event.register("shcopyitem") {
+ description = "Copies information about the item in hand to the clipboard"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { CopyItemCommand.command() }
+ }
+ event.register("shcopyfoundburrowlocations") {
+ description = "Copy all ever found burrow locations to clipboard"
+ category = CommandCategory.DEVELOPER_DEBUG
+ callback { AllBurrowsList.copyToClipboard() }
}
}
- private fun registerCommand(rawName: String, description: String, function: (Array<String>) -> Unit) {
- val name = rawName.lowercase()
- if (commands.any { it.name == name }) {
- error("The command '$name is already registered!'")
+ @Suppress("LongMethod")
+ private fun devTest(event: RegisterCommandsEvent) {
+ event.register("shtest") {
+ description = "Unused test command."
+ category = CommandCategory.DEVELOPER_TEST
+ callback { SkyHanniDebugsAndTests.testCommand(it) }
+ }
+ event.register("shchathistory") {
+ description = "Show the unfiltered chat history"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { ChatManager.openChatFilterGUI(it) }
+ }
+ event.register("shreloadlocalrepo") {
+ description = "Reloading the local repo data"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { SkyHanniMod.repo.reloadLocalRepo() }
+ }
+ event.register("shgraph") {
+ description = "Enables the graph editor"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { GraphEditor.commandIn() }
+ }
+ event.register("shrepopatterns") {
+ description = "See where regexes are loaded from"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { RepoPatternGui.open() }
+ }
+ event.register("shtestrabbitpaths") {
+ description = "Tests pathfinding to rabbit eggs. Use a number 0-14."
+ category = CommandCategory.DEVELOPER_TEST
+ callback { HoppityEggLocator.testPathfind(it) }
+ }
+ event.register("shtestitem") {
+ description = "test item internal name resolving"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { SkyHanniDebugsAndTests.testItemCommand(it) }
+ }
+ event.register("shfindnullconfig") {
+ description = "Find config elements that are null and prints them into the console"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { SkyHanniDebugsAndTests.findNullConfig(it) }
+ }
+ event.register("shtestwaypoint") {
+ description = "Set a waypoint on that location"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { SkyHanniDebugsAndTests.waypoint(it) }
+ }
+ event.register("shtesttablist") {
+ description = "Set your clipboard as a fake tab list."
+ category = CommandCategory.DEVELOPER_TEST
+ callback { TabListData.toggleDebug() }
+ }
+ event.register("shstoplisteners") {
+ description = "Unregistering all loaded forge event listeners"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { SkyHanniDebugsAndTests.stopListeners() }
+ }
+ event.register("shreloadlisteners") {
+ description = "Trying to load all forge event listeners again. Might not work at all"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { SkyHanniDebugsAndTests.reloadListeners() }
+ }
+ event.register("shtracksounds") {
+ description = "Tracks the sounds for the specified duration (in seconds) and copies it to the clipboard"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { TrackSoundsCommand.command(it) }
+ }
+ event.register("shtrackparticles") {
+ description = "Tracks the particles for the specified duration (in seconds) and copies it to the clipboard"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { TrackParticlesCommand.command(it) }
+ }
+ event.register("shtestpacket") {
+ description = "Logs incoming and outgoing packets to the console"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { PacketTest.command(it) }
+ }
+ event.register("shtestmessage") {
+ description = "Sends a custom chat message client side in the chat"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { TestChatCommand.command(it) }
+ }
+ event.register("shtestrainbow") {
+ description = "Sends a rainbow in chat"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { ExtendedChatColor.testCommand() }
+ }
+ event.register("shpartydebug") {
+ description = "List persons into the chat SkyHanni thinks are in your party."
+ category = CommandCategory.DEVELOPER_TEST
+ callback { PartyAPI.listMembers() }
+ }
+ event.register("shplaysound") {
+ description = "Play the specified sound effect at the given pitch and volume."
+ category = CommandCategory.DEVELOPER_TEST
+ callback { SoundUtils.command(it) }
+ }
+ event.register("shsendtitle") {
+ description = "Display a title on the screen with the specified settings."
+ category = CommandCategory.DEVELOPER_TEST
+ callback { TitleManager.command(it) }
+ }
+ event.register("shresetconfig") {
+ description = "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)."
+ category = CommandCategory.DEVELOPER_TEST
+ callback { SkyHanniDebugsAndTests.resetConfigCommand() }
+ }
+ event.register("shreadcropmilestonefromclipboard") {
+ description = "Read crop milestone from clipboard. This helps fixing wrong crop milestone data"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { GardenCropMilestonesCommunityFix.readDataFromClipboard() }
+ }
+ event.register("shaddfoundburrowlocationsfromclipboard") {
+ description = "Add all ever found burrow locations from clipboard"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { AllBurrowsList.addFromClipboard() }
+ }
+ event.register("shtoggleegglocationdebug") {
+ description = "Shows Hoppity egg locations with their internal API names and status."
+ category = CommandCategory.DEVELOPER_TEST
+ callback { HoppityEggLocations.toggleDebug() }
+ }
+ event.register("shtranslateadvanced") {
+ description = "Translates a message in an inputted language to another inputted language."
+ category = CommandCategory.DEVELOPER_TEST
+ callback { Translator.translateAdvancedCommand(it) }
+ }
+ event.register("shconfigsave") {
+ description = "Manually saving the config"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { SkyHanniMod.configManager.saveConfig(ConfigFileType.FEATURES, "manual-command") }
+ }
+ event.register("shtestburrow") {
+ description = "Sets a test burrow waypoint at your location"
+ category = CommandCategory.DEVELOPER_TEST
+ callback { GriffinBurrowHelper.setTestBurrow(it) }
+ }
+ event.register("shtestisland") {
+ description = "Sets the current skyblock island for testing purposes."
+ category = CommandCategory.DEVELOPER_TEST
+ callback { SkyBlockIslandTest.onCommand(it) }
}
- ClientCommandHandler.instance.registerCommand(SimpleCommand(name, createCommand(function)))
- commands.add(CommandInfo(name, description, currentCategory))
}
- private fun registerCommand0(
- name: String,
- description: String,
- function: (Array<String>) -> Unit,
- autoComplete: ((Array<String>) -> List<String>) = { listOf() },
- ) {
- val command = SimpleCommand(
- name,
- createCommand(function),
- object : SimpleCommand.TabCompleteRunnable {
- override fun tabComplete(
- sender: ICommandSender?,
- args: Array<String>?,
- pos: BlockPos?,
- ): List<String> {
- return autoComplete(args ?: emptyArray())
- }
- },
- )
- ClientCommandHandler.instance.registerCommand(command)
- commands.add(CommandInfo(name, description, currentCategory))
+ private fun internalCommands(event: RegisterCommandsEvent) {
+ event.register("shaction") {
+ description = "Internal command for chat click actions"
+ category = CommandCategory.INTERNAL
+ callback { ChatClickActionManager.onCommand(it) }
+ }
}
- private fun createCommand(function: (Array<String>) -> Unit) = object : SimpleCommand.ProcessCommandRunnable() {
- override fun processCommand(sender: ICommandSender?, args: Array<String>?) {
- if (args != null) function(args.asList().toTypedArray())
+ private fun shortenedCommands(event: RegisterCommandsEvent) {
+ event.register("pko") {
+ description = "Kicks offline party members"
+ category = CommandCategory.SHORTENED_COMMANDS
+ callback { PartyCommands.kickOffline() }
+ }
+ event.register("pw") {
+ description = "Warps your party"
+ category = CommandCategory.SHORTENED_COMMANDS
+ callback { PartyCommands.warp() }
+ }
+ event.register("pk") {
+ description = "Kick a specific party member"
+ category = CommandCategory.SHORTENED_COMMANDS
+ callback { PartyCommands.kick(it) }
+ }
+ event.register("pt") {
+ description = "Transfer the party to another party member"
+ category = CommandCategory.SHORTENED_COMMANDS
+ callback { PartyCommands.transfer(it) }
+ }
+ event.register("pp") {
+ description = "Promote a specific party member"
+ category = CommandCategory.SHORTENED_COMMANDS
+ callback { PartyCommands.promote(it) }
+ }
+ event.register("pd") {
+ description = "Disbands the party"
+ category = CommandCategory.SHORTENED_COMMANDS
+ callback { PartyCommands.disband() }
+ }
+ event.register("rpt") {
+ description = "Reverse transfer party to the previous leader"
+ category = CommandCategory.SHORTENED_COMMANDS
+ callback { PartyCommands.reverseTransfer() }
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/RegisterCommandsEvent.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/RegisterCommandsEvent.kt
new file mode 100644
index 000000000..448b5d836
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/RegisterCommandsEvent.kt
@@ -0,0 +1,16 @@
+package at.hannibal2.skyhanni.config.commands
+
+import at.hannibal2.skyhanni.api.event.SkyHanniEvent
+import at.hannibal2.skyhanni.config.commands.Commands.commands
+import net.minecraftforge.client.ClientCommandHandler
+
+object RegisterCommandsEvent : SkyHanniEvent() {
+ fun register(name: String, block: CommandBuilder.() -> Unit) {
+ val info = CommandBuilder(name).apply(block)
+ if (commands.any { it.name == name }) {
+ error("The command '$name is already registered!'")
+ }
+ ClientCommandHandler.instance.registerCommand(info.toSimpleCommand())
+ commands.add(info)
+ }
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt
index b8a5871b7..6240b43bf 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt
@@ -5,47 +5,26 @@ import net.minecraft.command.CommandBase
import net.minecraft.command.ICommandSender
import net.minecraft.util.BlockPos
-class SimpleCommand : CommandBase {
-
- private val commandName: String
- private val runnable: ProcessCommandRunnable
- private var tabRunnable: TabCompleteRunnable? = null
-
- constructor(commandName: String, runnable: ProcessCommandRunnable) {
- this.commandName = commandName
- this.runnable = runnable
- }
-
- constructor(commandName: String, runnable: ProcessCommandRunnable, tabRunnable: TabCompleteRunnable?) {
- this.commandName = commandName
- this.runnable = runnable
- this.tabRunnable = tabRunnable
- }
-
- abstract class ProcessCommandRunnable {
-
- abstract fun processCommand(sender: ICommandSender?, args: Array<String>?)
- }
-
- interface TabCompleteRunnable {
-
- fun tabComplete(sender: ICommandSender?, args: Array<String>?, pos: BlockPos?): List<String>
- }
+class SimpleCommand(
+ private val name: String,
+ private val aliases: List<String>,
+ private val callback: (Array<String>) -> Unit,
+ private val tabCallback: ((Array<String>) -> List<String>) = { emptyList() },
+) : CommandBase() {
override fun canCommandSenderUseCommand(sender: ICommandSender) = true
-
- override fun getCommandName() = commandName
-
- override fun getCommandUsage(sender: ICommandSender) = "/$commandName"
+ override fun getCommandName() = name
+ override fun getCommandAliases() = aliases
+ override fun getCommandUsage(sender: ICommandSender) = "/$name"
override fun processCommand(sender: ICommandSender, args: Array<String>) {
try {
- runnable.processCommand(sender, args)
+ callback(args)
} catch (e: Throwable) {
- ErrorManager.logErrorWithData(e, "Error while running command /$commandName")
+ ErrorManager.logErrorWithData(e, "Error while running command /$name")
}
}
override fun addTabCompletionOptions(sender: ICommandSender, args: Array<String>, pos: BlockPos) =
- if (tabRunnable != null) tabRunnable!!.tabComplete(sender, args, pos) else null
+ tabCallback(args).takeIf { it.isNotEmpty() }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/FarmingFortuneConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/FarmingFortuneConfig.java
index 6eb4660d6..a1cb92be0 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/FarmingFortuneConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/FarmingFortuneConfig.java
@@ -1,8 +1,8 @@
package at.hannibal2.skyhanni.config.features.garden;
import at.hannibal2.skyhanni.config.FeatureToggle;
-import at.hannibal2.skyhanni.config.commands.Commands;
import at.hannibal2.skyhanni.config.core.config.Position;
+import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorButton;
@@ -21,7 +21,7 @@ public class FarmingFortuneConfig {
@ConfigOption(name = "Farming Fortune Guide", desc = "Open a guide that breaks down your Farming Fortune.\n§eCommand: /ff")
@ConfigEditorButton(buttonText = "Open")
- public Runnable open = Commands::openFortuneGuide;
+ public Runnable open = FFGuideGUI::onCommand;
@Expose
@ConfigLink(owner = FarmingFortuneConfig.class, field = "display")
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java
index 21cfee5c5..5a0db7ac4 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/ModifyWordsConfig.java
@@ -1,7 +1,7 @@
package at.hannibal2.skyhanni.config.features.gui;
import at.hannibal2.skyhanni.config.FeatureToggle;
-import at.hannibal2.skyhanni.config.commands.Commands;
+import at.hannibal2.skyhanni.features.misc.visualwords.VisualWordGui;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorButton;
@@ -17,6 +17,6 @@ public class ModifyWordsConfig {
@ConfigOption(name = "Open Config", desc = "Open the menu to setup the visual words.\n§eCommand: /shwords")
@ConfigEditorButton(buttonText = "Open")
- public Runnable open = Commands::openVisualWords;
+ public Runnable open = VisualWordGui::onCommand;
}