aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt b/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt
index 7ac530452..e3df5c54c 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/TestExportTools.kt
@@ -42,7 +42,7 @@ object TestExportTools {
@SubscribeEvent
fun onKeybind(event: GuiScreenEvent.KeyboardInputEvent) {
- if (!Keyboard.getEventKeyState() || Keyboard.getEventKey() != SkyHanniMod.feature.dev.copyNBTDataCompressed) return
+ if (!Keyboard.isKeyDown(SkyHanniMod.feature.dev.copyNBTDataCompressed)) 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/utils/OSUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
index 63b8e01fb..9c56d142f 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.utils
+import at.hannibal2.skyhanni.test.command.CopyErrorCommand
import net.minecraft.client.settings.KeyBinding
import org.lwjgl.input.Keyboard
import java.awt.Desktop
@@ -28,7 +29,11 @@ object OSUtils {
}
fun copyToClipboard(text: String) {
- Toolkit.getDefaultToolkit().systemClipboard.setContents(StringSelection(text), null)
+ try {
+ Toolkit.getDefaultToolkit().systemClipboard.setContents(StringSelection(text), null)
+ } catch (e: Exception) {
+ CopyErrorCommand.logError(e, "Error while trying to set clipboard content.")
+ }
}
fun readFromClipboard(): String? {