aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/ChatPeek.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PasteIntoSigns.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt21
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt (renamed from src/main/java/at/hannibal2/skyhanni/utils/KeyboardUtils.kt)37
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt27
28 files changed, 94 insertions, 90 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 274fd60c7..528e7e4a2 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -283,7 +283,7 @@ import at.hannibal2.skyhanni.test.TestExportTools
import at.hannibal2.skyhanni.test.TestShowSlotNumber
import at.hannibal2.skyhanni.test.command.CopyNearbyParticlesCommand
import at.hannibal2.skyhanni.utils.EntityOutlineRenderer
-import at.hannibal2.skyhanni.utils.KeyboardUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.MinecraftConsoleFilter.Companion.initLogging
import at.hannibal2.skyhanni.utils.NEUVersionCheck.checkIfNeuIsLoaded
import at.hannibal2.skyhanni.utils.TabListData
@@ -354,7 +354,7 @@ class SkyHanniMod {
loadModule(BlockData())
loadModule(DefaultConfigFeatures)
loadModule(EntityOutlineRenderer)
- loadModule(KeyboardUtils)
+ loadModule(KeyboardManager)
// APIs
loadModule(BazaarApi())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt
index 1d0f0e1e4..4e72a0fb4 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt
@@ -24,7 +24,7 @@ import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsY
import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getDummySize
import at.hannibal2.skyhanni.data.OtherInventoryData
import at.hannibal2.skyhanni.utils.GuiRenderUtils
-import at.hannibal2.skyhanni.utils.KeyboardUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzUtils.round
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.GuiScreen
@@ -177,7 +177,7 @@ class GuiPositionEditor(private val positions: List<Position>, private val borde
val position = positions[clickedPos]
if (position.clicked) return
- val dist = if (KeyboardUtils.isShiftKeyDown()) 10 else 1
+ val dist = if (KeyboardManager.isShiftKeyDown()) 10 else 1
val elementWidth = position.getDummySize(true).x
val elementHeight = position.getDummySize(true).y
when (keyCode) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt
index 4d08c371f..05a3ba456 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilterGui.kt
@@ -1,7 +1,7 @@
package at.hannibal2.skyhanni.features.chat
import at.hannibal2.skyhanni.data.ChatManager
-import at.hannibal2.skyhanni.utils.KeyboardUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.OSUtils
import io.github.moulberry.moulconfig.internal.GlScissorStack
@@ -59,7 +59,7 @@ class ChatFilterGui(private val history: List<ChatManager.MessageFilteringResult
)
}
if (mouseX in 0..w && mouseY in 0..(size * 10) && (isMouseButtonDown && !wasMouseButtonDown)) {
- if (KeyboardUtils.isShiftKeyDown()) {
+ if (KeyboardManager.isShiftKeyDown()) {
OSUtils.copyToClipboard(IChatComponent.Serializer.componentToJson(msg.message))
LorenzUtils.chat("Copied structured chat line to clipboard")
} else {
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 caf2cb014..18e6318dc 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
@@ -9,12 +9,12 @@ import at.hannibal2.skyhanni.events.LorenzKeyPressEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.PacketEvent
+import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzLogger
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
import at.hannibal2.skyhanni.utils.LorenzVec
-import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.StringUtils.cleanPlayerName
@@ -141,7 +141,7 @@ object InquisitorWaypointShare {
// add repo kill switch
sendInquisitor()
} else {
- val keyName = OSUtils.getKeyName(config.keyBindShare)
+ val keyName = KeyboardManager.getKeyName(config.keyBindShare)
val message =
"§e[SkyHanni] §l§bYou found a Inquisitor! Press §l§chere §l§bor §c$keyName to share the location!"
LorenzUtils.clickableChat(message, "shshareinquis")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt
index a3e491e02..c841eff38 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingTimer.kt
@@ -5,11 +5,11 @@ import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.utils.EntityUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.LorenzVec
-import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.SoundUtils
import at.hannibal2.skyhanni.utils.TimeUnit
@@ -39,7 +39,7 @@ class FishingTimer {
if (event.isMod(5)) checkMobs()
if (event.isMod(7)) tryPlaySound()
- if (OSUtils.isKeyHeld(config.manualResetTimer)) startTime = System.currentTimeMillis()
+ if (config.manualResetTimer.isKeyHeld()) startTime = System.currentTimeMillis()
}
private fun tryPlaySound() {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt
index 2c0d78c7b..cf629bcb5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt
@@ -4,11 +4,11 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old
+import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
-import at.hannibal2.skyhanni.utils.OSUtils
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import org.lwjgl.input.Keyboard
@@ -24,7 +24,7 @@ class TrophyFishFillet {
val trophyRarityName = internalName.substringAfterLast("_")
val info = TrophyFishManager.getInfo(trophyFishName) ?: return
val rarity = TrophyRarity.getByName(trophyRarityName) ?: return
- val multiplier = if (OSUtils.isKeyHeld(Keyboard.KEY_LSHIFT)) event.itemStack.stackSize else 1
+ val multiplier = if (Keyboard.KEY_LSHIFT.isKeyHeld()) event.itemStack.stackSize else 1
val filletValue = info.getFilletValue(rarity) * multiplier
val filletPrice = filletValue * NEUItems.getPrice("MAGMA_FISH")
event.toolTip.add("§7Fillet: §8${filletValue.addSeparators()} Magmafish §7(§6${NumberUtil.format(filletPrice)}§7)")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt
index db4ebde20..c0cc75670 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/ToolTooltipTweaks.kt
@@ -7,8 +7,8 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI.getCropType
import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getFarmingForDummiesCount
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getReforgeName
import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase
@@ -85,7 +85,7 @@ class ToolTooltipTweaks {
}
iterator.set(fortuneLine)
- if (OSUtils.isKeyHeld(config.fortuneTooltipKeybind)) {
+ if (config.fortuneTooltipKeybind.isKeyHeld()) {
iterator.addStat(" §7Base: §6+", baseFortune)
iterator.addStat(" §7Tool: §6+", toolFortune)
iterator.addStat(" §7${reforgeName?.removeColor()}: §9+", reforgeFortune)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
index 438fcf4a1..83da09fd5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
@@ -15,7 +15,7 @@ import at.hannibal2.skyhanni.features.garden.composter.ComposterAPI.getLevel
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.name
-import at.hannibal2.skyhanni.utils.KeyboardUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector
@@ -422,7 +422,7 @@ class ComposterOverlay {
val name = itemName.substring(0, 2) + selected + rawItemName
list.add(Renderable.link("$name §8x${itemsNeeded.addSeparators()} §7(§6$format§7)") {
onClick(internalName)
- if (KeyboardUtils.isControlKeyDown() && lastAttemptTime.passedSince() > 500.milliseconds) {
+ if (KeyboardManager.isControlKeyDown() && lastAttemptTime.passedSince() > 500.milliseconds) {
lastAttemptTime = SimpleTimeMark.now()
retrieveMaterials(internalName, itemName, itemsNeeded.toInt())
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt
index 06861c269..16393cbab 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCustomKeybinds.kt
@@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.garden.farming
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.mixins.transformers.AccessorKeyBinding
-import at.hannibal2.skyhanni.utils.OSUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.inventory.GuiEditSign
import net.minecraft.client.settings.KeyBinding
@@ -53,7 +53,7 @@ object GardenCustomKeybinds {
if (!isActive()) return
val override = map[keyBinding] ?: return
val keyCode = override()
- cir.returnValue = OSUtils.isKeyHeld(keyCode)
+ cir.returnValue = keyCode.isKeyHeld()
}
@JvmStatic
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
index e34b0ab84..ab13c2aec 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
@@ -31,6 +31,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getItemName
import at.hannibal2.skyhanni.utils.ItemUtils.getItemNameOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
+import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzLogger
@@ -43,7 +44,6 @@ import at.hannibal2.skyhanni.utils.NEUItems.getItemStack
import at.hannibal2.skyhanni.utils.NEUItems.getPrice
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
-import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.RenderUtils.exactLocation
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
@@ -305,7 +305,7 @@ class GardenVisitorFeatures {
visitor.hasReward()?.let {
if (config.visitorRewardWarning.preventRefusing) {
- if (OSUtils.isKeyHeld(config.visitorRewardWarning.bypassKey)) {
+ if (config.visitorRewardWarning.bypassKey.isKeyHeld()) {
LorenzUtils.chat("§e[SkyHanni] §cBypassed blocking refusal of visitor ${visitor.visitorName} §7(${it.displayName}§7)")
return
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
index e8add811e..79b1ddb7b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
@@ -18,7 +18,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.isEnchanted
import at.hannibal2.skyhanni.utils.ItemUtils.isVanilla
-import at.hannibal2.skyhanni.utils.KeyboardUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.equalsOneOf
@@ -166,7 +166,7 @@ class HideNotClickableItems {
}
}
- private fun bypasssActive() = config.notClickableItemsBypass && KeyboardUtils.isControlKeyDown()
+ private fun bypasssActive() = config.notClickableItemsBypass && KeyboardManager.isControlKeyDown()
private fun isDisabled(): Boolean {
if (bypassUntil > System.currentTimeMillis()) return true
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt
index eee1b0613..0fd9f2cc2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt
@@ -7,7 +7,7 @@ import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.name
-import at.hannibal2.skyhanni.utils.KeyboardUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
@@ -39,7 +39,7 @@ class QuickCraftFeatures {
@SubscribeEvent
fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) {
if (!isEnabled()) return
- if (KeyboardUtils.isControlKeyDown()) return
+ if (KeyboardManager.isControlKeyDown()) return
if (event.gui !is GuiChest) return
val chest = event.gui.inventorySlots as ContainerChest
@@ -62,7 +62,7 @@ class QuickCraftFeatures {
val clickedItem = event.slot?.stack ?: return
- if (!KeyboardUtils.isControlKeyDown() && needsQuickCraftConfirmation(clickedItem)) {
+ if (!KeyboardManager.isControlKeyDown() && needsQuickCraftConfirmation(clickedItem)) {
event.isCanceled = true
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ChatPeek.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ChatPeek.kt
index efc6e3d1e..eb9b49a78 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/ChatPeek.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ChatPeek.kt
@@ -1,8 +1,8 @@
package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.NEUItems
-import at.hannibal2.skyhanni.utils.OSUtils
import io.github.moulberry.moulconfig.gui.GuiScreenElementWrapper
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.inventory.GuiEditSign
@@ -21,6 +21,6 @@ object ChatPeek {
if (NEUItems.neuHasFocus()) return false
- return OSUtils.isKeyHeld(key)
+ return key.isKeyHeld()
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt
index 72cad7e00..e483aa980 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt
@@ -4,8 +4,8 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.RenderItemTipEvent
import at.hannibal2.skyhanni.utils.InventoryUtils.openInventoryName
+import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.inventory.GuiChest
@@ -40,7 +40,7 @@ class HarpFeatures {
val chest = event.gui as? GuiChest ?: return
for (key in keys) {
- if (OSUtils.isKeyHeld(key)) {
+ if (key.isKeyHeld()) {
if (lastClick.passedSince() > 200.milliseconds) {
Minecraft.getMinecraft().playerController.windowClick(
chest.inventorySlots.windowId,
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PasteIntoSigns.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PasteIntoSigns.kt
index 9da2b804d..5bedd57cc 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/PasteIntoSigns.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PasteIntoSigns.kt
@@ -2,7 +2,7 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.LorenzTickEvent
-import at.hannibal2.skyhanni.utils.KeyboardUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.OSUtils
import kotlinx.coroutines.launch
@@ -16,7 +16,7 @@ class PasteIntoSigns {
if (!LorenzUtils.onHypixel) return
if (!SkyHanniMod.feature.misc.pasteIntoSigns) return
- val currentlyClicked = KeyboardUtils.isPastingKeysDown()
+ val currentlyClicked = KeyboardManager.isPastingKeysDown()
if (!lastClicked && currentlyClicked) {
SkyHanniMod.coroutineScope.launch {
OSUtils.readFromClipboard()?.let {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt
index d0c81aa4a..e39973d15 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt
@@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.name
-import at.hannibal2.skyhanni.utils.KeyboardUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzRarity
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible
@@ -27,7 +27,7 @@ class PetExpTooltip {
fun onItemTooltipLow(event: ItemTooltipEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!config.petDisplay) return
- if (!KeyboardUtils.isShiftKeyDown() && !config.showAlways) return
+ if (!KeyboardManager.isShiftKeyDown() && !config.showAlways) return
val itemStack = event.itemStack ?: return
val petExperience = itemStack.getPetExp()?.round(1) ?: return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt
index 3759d432e..e5763ed58 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/SkyBlockKickDuration.kt
@@ -24,6 +24,7 @@ class SkyBlockKickDuration {
fun onChat(event: LorenzChatEvent) {
if (!isEnabled()) return
if (event.message == "§cYou were kicked while joining that server!") {
+ //if is in hub: enable rn
kickMessage = true
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt
index 225407778..59ecd2724 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt
@@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.data.FriendAPI
import at.hannibal2.skyhanni.data.GuildAPI
import at.hannibal2.skyhanni.data.PartyAPI
import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager
-import at.hannibal2.skyhanni.utils.KeyboardUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
@@ -114,7 +114,7 @@ object AdvancedPlayerList {
return newList
}
- fun ignoreCustomTabList() = SkyHanniMod.feature.dev.debugEnabled && KeyboardUtils.isControlKeyDown()
+ fun ignoreCustomTabList() = SkyHanniMod.feature.dev.debugEnabled && KeyboardManager.isControlKeyDown()
private val listOfSkyHanniDevsOrPeopeWhoKnowALotAboutModdingSeceneButAreBadInCoding = listOf(
"hannibal2",
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
index 60a790297..0386300e6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
@@ -16,6 +16,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment
+import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.LorenzRarity
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
@@ -29,7 +30,6 @@ import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull
import at.hannibal2.skyhanni.utils.NEUItems.manager
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
-import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.GemstoneSlotType
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAbilityScrolls
@@ -97,7 +97,7 @@ object EstimatedItemValue {
fun onRenderOverlay(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!config.estimatedIemValueEnabled) return
- if (!OSUtils.isKeyHeld(config.estimatedItemValueHotkey) && !config.estimatedIemValueAlwaysEnabled) return
+ if (!config.estimatedItemValueHotkey.isKeyHeld() && !config.estimatedIemValueAlwaysEnabled) return
if (System.currentTimeMillis() > lastToolTipTime + 200) return
config.itemPriceDataPos.renderStringsAndItems(display, posLabel = "Estimated Item Value")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt
index 7fa82bcf9..5906d136a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt
@@ -11,10 +11,10 @@ import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.features.nether.reputationhelper.dailykuudra.DailyKuudraBossHelper
import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.DailyQuestHelper
import at.hannibal2.skyhanni.features.nether.reputationhelper.miniboss.DailyMiniBossHelper
+import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzVec
-import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.TabListData
import com.google.gson.JsonObject
@@ -112,7 +112,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
if (!LorenzUtils.inSkyBlock) return
if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return
- if (config.useHotkey && !OSUtils.isKeyHeld(config.hotkey)) {
+ if (config.useHotkey && !config.hotkey.isKeyHeld()) {
return
}
@@ -162,7 +162,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) {
fun showLocations() = when (config.showLocation) {
0 -> true
- 1 -> OSUtils.isKeyHeld(config.hotkey)
+ 1 -> config.hotkey.isKeyHeld()
else -> false
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt
index 5c41ff0ca..00d4ad0d2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt
@@ -16,7 +16,7 @@ import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.getBazaarData
import at.hannibal2.skyhanni.test.PriceSource
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.name
-import at.hannibal2.skyhanni.utils.KeyboardUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzLogger
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
@@ -252,7 +252,7 @@ object SlayerItemProfitTracker {
) {
if (System.currentTimeMillis() > lastClickDelay + 150) {
- if (KeyboardUtils.isControlKeyDown()) {
+ if (KeyboardManager.isControlKeyDown()) {
itemLog.items.remove(internalName)
LorenzUtils.chat("§e[SkyHanni] Removed $cleanName §efrom slayer profit display.")
lastClickDelay = System.currentTimeMillis() + 500
diff --git a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt
index e74a6acff..65e2e6275 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt
@@ -29,15 +29,18 @@ class ParkourWaypointSaver {
if (NEUItems.neuHasFocus()) return
if (timeLastSaved.passedSince() < 250.milliseconds) return
- if (config.deleteKey == event.keyCode) {
- locations = locations.dropLast(1).toMutableList()
- update()
- }
- if (config.saveKey == event.keyCode) {
- val newLocation = LorenzVec.getBlockBelowPlayer()
- if (locations.isNotEmpty() && newLocation == locations.last()) return
- locations.add(newLocation)
- update()
+ when (event.keyCode) {
+ config.deleteKey -> {
+ locations = locations.dropLast(1).toMutableList()
+ update()
+ }
+
+ config.saveKey -> {
+ val newLocation = LorenzVec.getBlockBelowPlayer()
+ if (locations.isNotEmpty() && newLocation == locations.last()) return
+ locations.add(newLocation)
+ update()
+ }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
index 3a0660c2d..6e2d2d1ab 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
@@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.name
+import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzDebug
import at.hannibal2.skyhanni.utils.LorenzLogger
@@ -267,7 +268,7 @@ class SkyHanniDebugsAndTests {
@SubscribeEvent
fun onKeybind(event: GuiScreenEvent.KeyboardInputEvent.Post) {
- if (!OSUtils.isKeyHeld(SkyHanniMod.feature.dev.copyInternalName)) return
+ if (!SkyHanniMod.feature.dev.copyInternalName.isKeyHeld()) return
val gui = event.gui as? GuiContainer ?: return
val focussedSlot = gui.slotUnderMouse ?: return
val stack = focussedSlot.stack ?: return
diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt b/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt
index 77547770a..426562e6f 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.test
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.utils.ItemStackTypeAdapterFactory
import at.hannibal2.skyhanni.utils.KSerializable
+import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.KotlinTypeAdapterFactory
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NBTTypeAdapter
@@ -47,7 +48,7 @@ object TestExportTools {
@SubscribeEvent
fun onKeybind(event: GuiScreenEvent.KeyboardInputEvent.Post) {
- if (!OSUtils.isKeyHeld(SkyHanniMod.feature.dev.copyNBTDataCompressed)) return
+ if (!SkyHanniMod.feature.dev.copyNBTDataCompressed.isKeyHeld()) return
val gui = event.gui as? GuiContainer ?: return
val focussedSlot = gui.slotUnderMouse ?: return
val stack = focussedSlot.stack ?: return
diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt b/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt
index 115cef414..9b11abd60 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt
@@ -2,14 +2,14 @@ package at.hannibal2.skyhanni.test
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent
-import at.hannibal2.skyhanni.utils.OSUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class TestShowSlotNumber {
@SubscribeEvent
fun onRenderItemTip(event: RenderInventoryItemTipEvent) {
- if (OSUtils.isKeyHeld(SkyHanniMod.feature.dev.showSlotNumberKey)) {
+ if (SkyHanniMod.feature.dev.showSlotNumberKey.isKeyHeld()) {
val slotIndex = event.slot.slotIndex
event.stackTip = "$slotIndex"
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
index 6c2ef3a37..8c713558f 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
@@ -1,7 +1,7 @@
package at.hannibal2.skyhanni.test.command
import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.utils.KeyboardUtils
+import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
@@ -30,7 +30,7 @@ object CopyErrorCommand {
}
val id = array[0]
- val fullErrorMessage = KeyboardUtils.isControlKeyDown()
+ val fullErrorMessage = KeyboardManager.isControlKeyDown()
val errorMessage = if (fullErrorMessage) {
fullErrorMessages[id]
} else {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
index b06a7621e..21a17e740 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
@@ -2,22 +2,24 @@ package at.hannibal2.skyhanni.utils
import at.hannibal2.skyhanni.events.LorenzKeyPressEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
+import io.github.moulberry.moulconfig.internal.KeybindHelper
+import net.minecraft.client.settings.KeyBinding
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import org.apache.commons.lang3.SystemUtils
import org.lwjgl.input.Keyboard
import org.lwjgl.input.Mouse
-object KeyboardUtils {
+object KeyboardManager {
private var lastClickedMouseButton = -1
// A mac-only key, represents Windows key on windows (but different key code)
- fun isCommandKeyDown() = OSUtils.isKeyHeld(Keyboard.KEY_LMETA) || OSUtils.isKeyHeld(Keyboard.KEY_RMETA)
- fun isControlKeyDown() = OSUtils.isKeyHeld(Keyboard.KEY_LCONTROL) || OSUtils.isKeyHeld(Keyboard.KEY_RCONTROL)
- fun isShiftKeyDown() = OSUtils.isKeyHeld(Keyboard.KEY_LSHIFT) || OSUtils.isKeyHeld(Keyboard.KEY_RSHIFT)
+ fun isCommandKeyDown() = Keyboard.KEY_LMETA.isKeyHeld() || Keyboard.KEY_RMETA.isKeyHeld()
+ fun isControlKeyDown() = Keyboard.KEY_LCONTROL.isKeyHeld() || Keyboard.KEY_RCONTROL.isKeyHeld()
+ fun isShiftKeyDown() = Keyboard.KEY_LSHIFT.isKeyHeld() || Keyboard.KEY_RSHIFT.isKeyHeld()
fun isPastingKeysDown(): Boolean {
val modifierHeld = if (SystemUtils.IS_OS_MAC) isCommandKeyDown() else isControlKeyDown()
- return modifierHeld && OSUtils.isKeyHeld(Keyboard.KEY_V)
+ return modifierHeld && Keyboard.KEY_V.isKeyHeld()
}
@SubscribeEvent
@@ -37,7 +39,7 @@ object KeyboardUtils {
}
if (Mouse.getEventButton() == -1 && lastClickedMouseButton != -1) {
- if (OSUtils.isKeyHeld(lastClickedMouseButton)) {
+ if (lastClickedMouseButton.isKeyHeld()) {
LorenzKeyPressEvent(lastClickedMouseButton).postAndCatch()
println("still holding")
return
@@ -50,4 +52,27 @@ object KeyboardUtils {
LorenzKeyPressEvent(Keyboard.getEventCharacter().code + 256).postAndCatch()
}
}
+
+ fun KeyBinding.isActive(): Boolean {
+ if (!Keyboard.isCreated()) return false
+ try {
+ if (keyCode.isKeyHeld()) return true
+ } catch (e: IndexOutOfBoundsException) {
+ println("KeyBinding isActive caused an IndexOutOfBoundsException with keyCode: $keyCode")
+ e.printStackTrace()
+ return false
+ }
+ return this.isKeyDown || this.isPressed
+ }
+
+ fun Int.isKeyHeld(): Boolean {
+ if (this == 0) return false
+ return if (this < 0) {
+ Mouse.isButtonDown(this + 100)
+ } else {
+ KeybindHelper.isKeyDown(this)
+ }
+ }
+
+ fun getKeyName(keyCode: Int): String = KeybindHelper.getKeyName(keyCode)
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
index 981ea87c3..b083b2d3b 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
@@ -1,9 +1,5 @@
package at.hannibal2.skyhanni.utils
-import io.github.moulberry.moulconfig.internal.KeybindHelper
-import net.minecraft.client.settings.KeyBinding
-import org.lwjgl.input.Keyboard
-import org.lwjgl.input.Mouse
import java.awt.Desktop
import java.io.IOException
import java.net.URI
@@ -30,27 +26,4 @@ object OSUtils {
}
suspend fun readFromClipboard() = ClipboardUtils.readFromClipboard()
-
- fun KeyBinding.isActive(): Boolean {
- if (!Keyboard.isCreated()) return false
- try {
- if (isKeyHeld(keyCode)) return true
- } catch (e: IndexOutOfBoundsException) {
- println("KeyBinding isActive caused an IndexOutOfBoundsException with keyCode: $keyCode")
- e.printStackTrace()
- return false
- }
- return this.isKeyDown || this.isPressed
- }
-
- fun isKeyHeld(keyCode: Int): Boolean {
- if (keyCode == 0) return false
- return if (keyCode < 0) {
- Mouse.isButtonDown(keyCode + 100)
- } else {
- KeybindHelper.isKeyDown(keyCode)
- }
- }
-
- fun getKeyName(keyCode: Int): String = KeybindHelper.getKeyName(keyCode)
}