Merge pull request #97 from carl-anders/keybindings-wrap-even-more-no-more-panics-plz

Keybindings: Catch even more errors, and manually check that operating system is Windows
This commit is contained in:
Eiren Rain authored and GitHub committed 2021-12-27 02:23:13 +03:00
commit 80ce825494
2 files changed
+9 -7

No files matched your search

+1 -1
View File
@@ -75,5 +75,5 @@ shadowJar {
archiveVersion.set('')
}
application {
mainClassName = 'io.eiren.vr.Main'
mainClassName = 'dev.slimevr.Main'
}
@@ -1,11 +1,10 @@
package dev.slimevr.gui;
import com.melloware.jintellitype.HotkeyListener;
import com.melloware.jintellitype.JIntellitype;
import com.melloware.jintellitype.JIntellitypeException;
import dev.slimevr.VRServer;
import com.melloware.jintellitype.HotkeyListener;
import io.eiren.util.OperatingSystem;
import io.eiren.util.ann.AWTThread;
import io.eiren.util.logging.LogManager;
@@ -18,6 +17,11 @@ public class Keybinding implements HotkeyListener {
public Keybinding(VRServer server) {
this.server = server;
if (OperatingSystem.getCurrentPlatform() != OperatingSystem.WINDOWS) {
LogManager.log.info("[Keybinding] Currently only supported on Windows. Keybindings will be disabled.");
return;
}
try {
if(JIntellitype.getInstance() instanceof JIntellitype) {
JIntellitype.getInstance().addHotKeyListener(this);
@@ -38,9 +42,7 @@ public class Keybinding implements HotkeyListener {
JIntellitype.getInstance().registerHotKey(QUICK_RESET, quickResetBinding);
LogManager.log.info("[Keybinding] Bound quick reset to " + quickResetBinding);
}
} catch(JIntellitypeException je) {
LogManager.log.info("[Keybinding] JIntellitype initialization failed. Keybindings will be disabled. Try restarting your computer.");
} catch(ExceptionInInitializerError e) {
} catch(Throwable e) {
LogManager.log.info("[Keybinding] JIntellitype initialization failed. Keybindings will be disabled. Try restarting your computer.");
}
}