diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
10 files changed, 76 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/HelpCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/HelpCommand.kt index 2eb5dc3fb..ffffc7511 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/commands/HelpCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/commands/HelpCommand.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.features.commands +import at.hannibal2.skyhanni.config.commands.CommandBuilder import at.hannibal2.skyhanni.config.commands.Commands +import at.hannibal2.skyhanni.config.commands.Commands.commands import at.hannibal2.skyhanni.utils.StringUtils.splitLines import at.hannibal2.skyhanni.utils.chat.Text import at.hannibal2.skyhanni.utils.chat.Text.hover @@ -12,7 +14,7 @@ object HelpCommand { private const val COMMANDS_PER_PAGE = 15 private const val HELP_ID = -6457563 - private fun createCommandEntry(command: Commands.CommandInfo): IChatComponent { + private fun createCommandEntry(command: CommandBuilder): IChatComponent { val category = command.category val color = category.color val description = command.description.splitLines(200).replace("§r", "§7") @@ -30,7 +32,7 @@ object HelpCommand { } } - private fun showPage(page: Int, search: String, commands: List<Commands.CommandInfo>) { + private fun showPage(page: Int, search: String, commands: List<CommandBuilder>) { val filtered = commands.filter { it.name.contains(search, ignoreCase = true) || it.description.contains(search, ignoreCase = true) } @@ -47,7 +49,7 @@ object HelpCommand { ) { createCommandEntry(it) } } - fun onCommand(args: Array<String>, commands: List<Commands.CommandInfo>) { + fun onCommand(args: Array<String>) { val page: Int val search: String if (args.firstOrNull() == "-p") { diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt index 377d7bfd4..5db28465e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt @@ -269,7 +269,7 @@ object CroesusChestTracker { fun resetChest() = croesusChests?.let { it.clear() it.addAll(generateMaxChest()) - ChatUtils.chat("Kismet State was cleared!") + ChatUtils.chat("Kismet State was Reset!") } @JvmStatic diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt index 6d201e57e..ead632ae6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityCollectionStats.kt @@ -520,9 +520,9 @@ object HoppityCollectionStats { } // bugfix for some weird potential user errors (e.g. if users play on alpha and get rabbits) - fun clearSavedRabbits() { + fun resetSavedRabbits() { loggedRabbits.clear() - ChatUtils.chat("Cleared saved rabbit data.") + ChatUtils.chat("Reset saved rabbit data.") } fun hasFoundRabbit(rabbit: String): Boolean = loggedRabbits.containsKey(rabbit) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index 7e1800931..460b11254 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -189,12 +189,18 @@ object GardenAPI { addItemStack(crop.icon.copy(), highlight = highlight, scale = scale) } - fun hideExtraGuis() = ComposterOverlay.inInventory || AnitaMedalProfit.inInventory || - SkyMartCopperPrice.inInventory || FarmingContestAPI.inInventory || VisitorAPI.inInventory || - FFGuideGUI.isInGui() || ChocolateShopPrice.inInventory || ChocolateFactoryAPI.inChocolateFactory || - ChocolateFactoryAPI.chocolateFactoryPaused || HoppityCollectionStats.inInventory - - fun clearCropSpeed() { + fun hideExtraGuis() = ComposterOverlay.inInventory || + AnitaMedalProfit.inInventory || + SkyMartCopperPrice.inInventory || + FarmingContestAPI.inInventory || + VisitorAPI.inInventory || + FFGuideGUI.isInGui() || + ChocolateShopPrice.inInventory || + ChocolateFactoryAPI.inChocolateFactory || + ChocolateFactoryAPI.chocolateFactoryPaused || + HoppityCollectionStats.inInventory + + fun resetCropSpeed() { storage?.cropsPerSecond?.clear() GardenBestCropTime.reset() updateGardenTool() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index e8b2d55e4..f3701c61a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -387,6 +387,13 @@ object CaptureFarmingGear { } } + fun onResetGearCommand() { + val storage = GardenAPI.storage?.fortune ?: return + ChatUtils.chat("Resets farming items") + storage.farmingItems.clear() + storage.outdatedItems.clear() + } + @SubscribeEvent fun onConfigUpdaterMigratorConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(48, "#profile.garden.fortune.carrotFortune", "#profile.garden.fortune.carrolyn.CARROT") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt index 3771dd112..8912bd4d1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt @@ -5,6 +5,8 @@ import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.fortuneguide.pages.CropPage import at.hannibal2.skyhanni.features.garden.fortuneguide.pages.OverviewPage import at.hannibal2.skyhanni.features.garden.fortuneguide.pages.UpgradePage +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.guide.GuideGUI import at.hannibal2.skyhanni.utils.guide.GuideTab import at.hannibal2.skyhanni.utils.renderables.Renderable @@ -20,6 +22,15 @@ class FFGuideGUI : GuideGUI<FFGuideGUI.FortuneGuidePage>(FortuneGuidePage.OVERVI companion object { + @JvmStatic + fun onCommand() { + if (!LorenzUtils.inSkyBlock) { + ChatUtils.userError("Join SkyBlock to open the fortune guide!") + } else { + open() + } + } + fun isInGui() = Minecraft.getMinecraft().currentScreen is FFGuideGUI fun open() { 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 9948d5eeb..1f9b2e66f 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 @@ -174,4 +174,28 @@ object UpdateManager { } private var potentialUpdate: PotentialUpdate? = null + + fun updateCommand(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 + } + + 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) + } + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt index b8de2eca6..fb2f72bed 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt @@ -4,10 +4,12 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigFileType import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ChatUtils.chat import at.hannibal2.skyhanni.utils.GuiRenderUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.KeyboardManager +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.SoundUtils @@ -63,6 +65,16 @@ open class VisualWordGui : GuiScreen() { companion object { + @JvmStatic + fun onCommand() { + if (!LorenzUtils.onHypixel) { + ChatUtils.userError("You need to join Hypixel to use this feature!") + } else { + if (sbeConfigPath.exists()) drawImport = true + SkyHanniMod.screenToOpen = VisualWordGui() + } + } + fun isInGui() = Minecraft.getMinecraft().currentScreen is VisualWordGui var sbeConfigPath = File("." + File.separator + "config" + File.separator + "SkyblockExtras.cfg") var drawImport = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/PunchcardHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/PunchcardHighlight.kt index d1fcea62e..a4068438f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/PunchcardHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/PunchcardHighlight.kt @@ -156,7 +156,7 @@ object PunchcardHighlight { RenderLivingEntityHelper.removeEntityColor(entity) } - fun clearList() { + fun onResetCommand() { playerList.clear() playerQueue.clear() if (config.reverse.get()) { 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 acd37e9d5..defde1cf2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt @@ -246,7 +246,7 @@ object SlayerProfitTracker { fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled - fun clearProfitCommand(args: Array<String>) { + fun resetCommand() { if (itemLogCategory == "") { ChatUtils.userError( "No current slayer data found! " + |