diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-20 00:11:21 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-20 00:11:21 +0100 |
commit | 990d54fb54adbf66affcbaa4c90667ecc834f386 (patch) | |
tree | 6beea17a6bafb21a202dbd0030ebf6956d63dc88 /src/main/java/at | |
parent | 5274873601f23daf743e215616405f04839a8474 (diff) | |
download | skyhanni-990d54fb54adbf66affcbaa4c90667ecc834f386.tar.gz skyhanni-990d54fb54adbf66affcbaa4c90667ecc834f386.tar.bz2 skyhanni-990d54fb54adbf66affcbaa4c90667ecc834f386.zip |
Remind every 30 minutes to set a hotkey for /sh gui.
Diffstat (limited to 'src/main/java/at')
3 files changed, 16 insertions, 4 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 096078cf5..641dc912d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -67,7 +67,7 @@ object Commands { private val openMainMenu: (Array<String>) -> Unit = { if (it.isNotEmpty()) { if (it[0].lowercase() == "gui") { - GuiEditManager.openGuiPositionEditor() + GuiEditManager.openGuiPositionEditor(hotkeyReminder = true) } else { ConfigGuiManager.openConfigGui(it.joinToString(" ")) } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java index 9e1816107..4eeadf221 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java @@ -16,7 +16,7 @@ public class GUIConfig { @ConfigOption(name = "Edit GUI Locations", desc = "Change the position of SkyHanni's overlays.") @ConfigEditorButton(buttonText = "Edit") - public Runnable positions = GuiEditManager::openGuiPositionEditor; + public Runnable positions = () -> GuiEditManager.openGuiPositionEditor(true); @Expose @ConfigOption(name = "Open Hotkey", desc = "Press this key to open the GUI Editor.") diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index 2f7617924..2486c7eee 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isRancherSign import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.SimpleTimeMark import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest @@ -18,6 +19,7 @@ import net.minecraft.client.renderer.GlStateManager import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.UUID +import kotlin.time.Duration.Companion.minutes class GuiEditManager { @SubscribeEvent @@ -33,7 +35,7 @@ class GuiEditManager { if (NEUItems.neuHasFocus()) return - openGuiPositionEditor() + openGuiPositionEditor(hotkeyReminder = false) } @SubscribeEvent(priority = EventPriority.LOWEST) @@ -60,9 +62,19 @@ class GuiEditManager { } } + private var lastHotkeyReminded = SimpleTimeMark.farPast() + @JvmStatic - fun openGuiPositionEditor() { + fun openGuiPositionEditor(hotkeyReminder: Boolean) { SkyHanniMod.screenToOpen = GuiPositionEditor(latestPositions.values.toList(), 2) + if (hotkeyReminder && lastHotkeyReminded.passedSince() > 30.minutes) { + lastHotkeyReminded = SimpleTimeMark.now() + LorenzUtils.chat( + "§eTo edit hidden GUI elements:\n" + + " §7- §e1. Set a key in /sh edit.\n" + + " §7- §e2. Click that key while the GUI element is visible." + ) + } } @JvmStatic |