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/config/features/inventory/HideNotClickableConfig.java3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/AdvancedPlayerList.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt2
9 files changed, 27 insertions, 22 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/HideNotClickableConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/HideNotClickableConfig.java
index 9c0c01602..3ce61c9f8 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/HideNotClickableConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/HideNotClickableConfig.java
@@ -29,9 +29,8 @@ public class HideNotClickableConfig {
minStep = 5
)
public int opacity = 180;
-
@Expose
- @ConfigOption(name = "Bypass With Control", desc = "Adds the ability to bypass not clickable items when holding the control key.")
+ @ConfigOption(name = "Bypass With Key", desc = "Adds the ability to bypass not clickable items when holding the control/command key.")
@ConfigEditorBoolean
public boolean itemsBypass = true;
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 ffb08f93b..5d14fc142 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
@@ -421,7 +421,7 @@ object ComposterOverlay {
val name = itemName.substring(0, 2) + selected + rawItemName
list.add(Renderable.link("$name §8x${itemsNeeded.addSeparators()} §7(§6$format§7)") {
onClick(internalName)
- if (KeyboardManager.isControlKeyDown() && lastAttemptTime.passedSince() > 500.milliseconds) {
+ if (KeyboardManager.isModifierKeyDown() && lastAttemptTime.passedSince() > 500.milliseconds) {
lastAttemptTime = SimpleTimeMark.now()
retrieveMaterials(internalName, itemName, itemsNeeded.toInt())
}
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 d0c6d91f8..3ea8ac0e3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
@@ -4,6 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.background
import at.hannibal2.skyhanni.data.ItemRenderBackground.Companion.borderLine
+import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson
+import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson.SalvageFilter
+import at.hannibal2.skyhanni.data.jsonobjects.repo.MultiFilterJson
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.features.bazaar.BazaarApi
@@ -27,9 +30,6 @@ import at.hannibal2.skyhanni.utils.MultiFilter
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRiftExportable
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRiftTransferable
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
-import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson
-import at.hannibal2.skyhanni.data.jsonobjects.repo.HideNotClickableItemsJson.SalvageFilter
-import at.hannibal2.skyhanni.data.jsonobjects.repo.MultiFilterJson
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.inventory.ContainerChest
@@ -131,7 +131,7 @@ class HideNotClickableItems {
} else {
event.toolTip.add("§c$hideReason")
if (config.itemsBypass) {
- event.toolTip.add(" §7(Bypass by holding the control key)")
+ event.toolTip.add(" §7(Bypass by holding the ${KeyboardManager.getModifierKeyName()} key)")
}
}
}
@@ -162,7 +162,7 @@ class HideNotClickableItems {
}
}
- private fun bypasssActive() = config.itemsBypass && KeyboardManager.isControlKeyDown()
+ private fun bypasssActive() = config.itemsBypass && KeyboardManager.isModifierKeyDown()
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 5265d6cfd..a72d5624f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt
@@ -32,14 +32,19 @@ class QuickCraftFeatures {
if (!isEnabled() || !quickCraftSlots.contains(event.slot.slotNumber)) return
if (needsQuickCraftConfirmation(event.itemStack)) {
- event.toolTip.replaceAll { it.replace("Click to craft!", "§cCtrl+Click to craft!") }
+ event.toolTip.replaceAll {
+ it.replace(
+ "Click to craft!",
+ "§c${KeyboardManager.getModifierKeyName()} + Click to craft!"
+ )
+ }
}
}
@SubscribeEvent
fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) {
if (!isEnabled()) return
- if (KeyboardManager.isControlKeyDown()) return
+ if (KeyboardManager.isModifierKeyDown()) return
if (event.gui !is GuiChest) return
val chest = event.gui.inventorySlots as ContainerChest
@@ -62,7 +67,7 @@ class QuickCraftFeatures {
val clickedItem = event.slot?.stack ?: return
- if (!KeyboardManager.isControlKeyDown() && needsQuickCraftConfirmation(clickedItem)) {
+ if (!KeyboardManager.isModifierKeyDown() && needsQuickCraftConfirmation(clickedItem)) {
event.isCanceled = 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 2eac62d1f..5598386f8 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
@@ -140,7 +140,7 @@ object AdvancedPlayerList {
}
fun ignoreCustomTabList(): Boolean {
- val denyKeyPressed = SkyHanniMod.feature.dev.debug.enabled && KeyboardManager.isControlKeyDown()
+ val denyKeyPressed = SkyHanniMod.feature.dev.debug.enabled && KeyboardManager.isModifierKeyDown()
return denyKeyPressed || !SkyHanniDebugsAndTests.globalRender
}
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 a996d7277..03cf21b1d 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
@@ -459,7 +459,7 @@ open class VisualWordGui : GuiScreen() {
super.keyTyped(typedChar, keyCode)
if (!currentlyEditing) {
if (keyCode == Keyboard.KEY_DOWN || keyCode == Keyboard.KEY_S) {
- if (KeyboardManager.isControlKeyDown()) {
+ if (KeyboardManager.isModifierKeyDown()) {
pageScroll = -(SkyHanniMod.feature.storage.modifiedWords.size * 30 - 100)
} else {
pageScroll -= 30
@@ -467,7 +467,7 @@ open class VisualWordGui : GuiScreen() {
scrollScreen()
}
if (keyCode == Keyboard.KEY_UP || keyCode == Keyboard.KEY_W) {
- if (KeyboardManager.isControlKeyDown()) {
+ if (KeyboardManager.isModifierKeyDown()) {
pageScroll = 0
} else {
pageScroll += 30
@@ -481,7 +481,7 @@ open class VisualWordGui : GuiScreen() {
if (keyCode == Keyboard.KEY_BACK) {
if (currentText.isNotEmpty()) {
- currentText = if (KeyboardManager.isControlKeyDown()) {
+ currentText = if (KeyboardManager.isModifierKeyDown()) {
""
} else if (KeyboardManager.isShiftKeyDown()) {
val lastSpaceIndex = currentText.lastIndexOf(' ')
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt
index cc24fbd5b..eaeed6aba 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt
@@ -34,7 +34,7 @@ object ErrorManager {
}
val id = array[0]
- val fullErrorMessage = KeyboardManager.isControlKeyDown()
+ val fullErrorMessage = KeyboardManager.isModifierKeyDown()
val errorMessage = if (fullErrorMessage) {
fullErrorMessages[id]
} else {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
index 5078a492f..a776de1b9 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
@@ -16,15 +16,16 @@ object KeyboardManager {
private var lastClickedMouseButton = -1
// A mac-only key, represents Windows key on windows (but different key code)
- fun isCommandKeyDown() = Keyboard.KEY_LMETA.isKeyHeld() || Keyboard.KEY_RMETA.isKeyHeld()
- fun isControlKeyDown() = Keyboard.KEY_LCONTROL.isKeyHeld() || Keyboard.KEY_RCONTROL.isKeyHeld()
+ private fun isCommandKeyDown() = Keyboard.KEY_LMETA.isKeyHeld() || Keyboard.KEY_RMETA.isKeyHeld()
+ private fun isControlKeyDown() = Keyboard.KEY_LCONTROL.isKeyHeld() || Keyboard.KEY_RCONTROL.isKeyHeld()
fun isShiftKeyDown() = Keyboard.KEY_LSHIFT.isKeyHeld() || Keyboard.KEY_RSHIFT.isKeyHeld()
- fun isPastingKeysDown() = isModifierHeld() && Keyboard.KEY_V.isKeyHeld()
+ fun isPastingKeysDown() = isModifierKeyDown() && Keyboard.KEY_V.isKeyHeld()
- fun isCopyingKeysDown() = isModifierHeld() && Keyboard.KEY_C.isKeyHeld()
+ fun isCopyingKeysDown() = isModifierKeyDown() && Keyboard.KEY_C.isKeyHeld()
- private fun isModifierHeld() = if (SystemUtils.IS_OS_MAC) isCommandKeyDown() else isControlKeyDown()
+ fun isModifierKeyDown() = if (SystemUtils.IS_OS_MAC) isCommandKeyDown() else isControlKeyDown()
+ fun getModifierKeyName(): String = if (SystemUtils.IS_OS_MAC) "Command" else "Control"
@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
index 7ea533166..2ca14d2cb 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
@@ -96,7 +96,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
val renderable = if (isInventoryOpen()) Renderable.clickAndHover(displayName, lore) {
if (System.currentTimeMillis() > lastClickDelay + 150) {
- if (KeyboardManager.isControlKeyDown()) {
+ if (KeyboardManager.isModifierKeyDown()) {
data.items.remove(internalName)
LorenzUtils.chat("Removed $cleanName §efrom Fishing Frofit Tracker.")
lastClickDelay = System.currentTimeMillis() + 500