aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-10 11:36:50 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-10 11:36:50 +0200
commitd0bbd687ca9d33cc7bd8f53e3103ecc92905f8dc (patch)
tree626b6ab0fd7caf52aea854e110014e5e939428ca /src
parent274e15bbfb84a6fd9f923e56ab2055665f4fb734 (diff)
downloadskyhanni-d0bbd687ca9d33cc7bd8f53e3103ecc92905f8dc.tar.gz
skyhanni-d0bbd687ca9d33cc7bd8f53e3103ecc92905f8dc.tar.bz2
skyhanni-d0bbd687ca9d33cc7bd8f53e3103ecc92905f8dc.zip
Fixed crash in Copy NBT data
Diffstat (limited to 'src')
-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? {