aboutsummaryrefslogtreecommitdiff
path: root/loader
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2023-11-11 21:37:07 +0900
committerGitHub <noreply@github.com>2023-11-11 21:37:07 +0900
commitde2ea64b5127570baa61ade6fd7a63416c8b7cb9 (patch)
tree78391b66157d3877428757feef7131243c39ee93 /loader
parent9e3e93a3337989d7f669678a495866b38fdf3f89 (diff)
downloadSkyblock-Dungeons-Guide-de2ea64b5127570baa61ade6fd7a63416c8b7cb9.tar.gz
Skyblock-Dungeons-Guide-de2ea64b5127570baa61ade6fd7a63416c8b7cb9.tar.bz2
Skyblock-Dungeons-Guide-de2ea64b5127570baa61ade6fd7a63416c8b7cb9.zip
No throwables (#436)
* - fix error handling, don't use throwables like amateur Signed-off-by: syeyoung <cyoung06@naver.com> * - no need for hack to stop Signed-off-by: syeyoung <cyoung06@naver.com> * - gui error handling Signed-off-by: syeyoung <cyoung06@naver.com> --------- Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'loader')
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/NotificationManager.java44
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/GuiScreenAdapter.java41
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/xml/PropByPropParsedWidgetConverter.java2
3 files changed, 44 insertions, 43 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/NotificationManager.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/NotificationManager.java
index 7e4ccdce..517e20ac 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/NotificationManager.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/NotificationManager.java
@@ -139,8 +139,8 @@ public class NotificationManager {
private void keyTyped(char typedChar, int keyCode) throws IOException {
try {
view.keyPressed0(typedChar, keyCode);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
}
@@ -148,8 +148,8 @@ public class NotificationManager {
private void keyHeld(int keyCode, char typedChar) throws IOException {
try {
view.keyHeld0(typedChar, keyCode);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
}
@@ -157,8 +157,8 @@ public class NotificationManager {
private void keyReleased(int keyCode, char typedChar) throws IOException {
try {
view.keyReleased0(typedChar, keyCode);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
}
@@ -167,8 +167,8 @@ public class NotificationManager {
try {
return view.mouseClicked0(mouseX, mouseY
, mouseX, mouseY, mouseButton);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
return false;
@@ -178,8 +178,8 @@ public class NotificationManager {
try {
view.mouseReleased0(mouseX, mouseY
, mouseX, mouseY, state);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
}
@@ -188,8 +188,8 @@ public class NotificationManager {
try {
view.mouseClickMove0(mouseX, mouseY
, mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
}
@@ -198,8 +198,8 @@ public class NotificationManager {
try {
view.mouseMoved0(mouseX, mouseY
, mouseX, mouseY, true);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
}
@@ -215,7 +215,6 @@ public class NotificationManager {
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void handleMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) throws IOException {
- try {
int i = Mouse.getEventX();
int j = this.mc.displayHeight - Mouse.getEventY();
int k = Mouse.getEventButton();
@@ -241,14 +240,14 @@ public class NotificationManager {
this.mouseClickMove(i, j, this.eventButton, l);
}
if (lastX != i || lastY != j) {
- try {
EnumCursor prevCursor = view.getCurrentCursor();
view.setCursor(EnumCursor.DEFAULT);
this.mouseMove(i, j);
EnumCursor newCursor = view.getCurrentCursor();
+ try {
if (prevCursor != newCursor) Mouse.setNativeCursor(GLCursors.getCursor(newCursor));
} catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+
e.printStackTrace();
}
}
@@ -256,14 +255,15 @@ public class NotificationManager {
int wheel = Mouse.getEventDWheel();
if (wheel != 0) {
- boolean cancel = view.mouseScrolled0(i, j, i, j, wheel);
- if (cancel) mouseInputEvent.setCanceled(true);
+ try {
+ boolean cancel = view.mouseScrolled0(i, j, i, j, wheel);
+ if (cancel) mouseInputEvent.setCanceled(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
lastX = i;
lastY = j;
- } catch (Throwable e) {
- e.printStackTrace();
- }
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/GuiScreenAdapter.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/GuiScreenAdapter.java
index 44dfb230..d6b2e496 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/GuiScreenAdapter.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/GuiScreenAdapter.java
@@ -137,8 +137,8 @@ public class GuiScreenAdapter extends GuiScreen {
try {
view.keyPressed0(typedChar, keyCode);
super.keyTyped(typedChar, keyCode);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
}
@@ -146,8 +146,8 @@ public class GuiScreenAdapter extends GuiScreen {
public void keyHeld(int keyCode, char typedChar) throws IOException {
try {
view.keyHeld0(typedChar, keyCode);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
}
@@ -155,8 +155,8 @@ public class GuiScreenAdapter extends GuiScreen {
public void keyReleased(int keyCode, char typedChar) throws IOException {
try {
view.keyReleased0(typedChar, keyCode);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
}
@@ -167,8 +167,8 @@ public class GuiScreenAdapter extends GuiScreen {
super.mouseClicked(mouseX, mouseY, mouseButton);
view.mouseClicked0(mouseX, mouseY
, mouseX, mouseY, mouseButton);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
}
@@ -192,8 +192,8 @@ public class GuiScreenAdapter extends GuiScreen {
try {
view.mouseReleased0(mouseX, mouseY
, mouseX, mouseY, state);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
}
@@ -203,8 +203,8 @@ public class GuiScreenAdapter extends GuiScreen {
try {
view.mouseClickMove0(mouseX, mouseY
, mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
}
@@ -213,8 +213,8 @@ public class GuiScreenAdapter extends GuiScreen {
try {
view.mouseMoved0(mouseX, mouseY
, mouseX, mouseY, true);
- } catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
+ } catch (Exception e) {
+
e.printStackTrace();
}
}
@@ -231,7 +231,6 @@ public class GuiScreenAdapter extends GuiScreen {
@Override
public void handleMouseInput() throws IOException {
if (!isOpen) return;
- try {
int i = Mouse.getEventX();
int j = this.mc.displayHeight - Mouse.getEventY();
int k = Mouse.getEventButton();
@@ -256,15 +255,14 @@ public class GuiScreenAdapter extends GuiScreen {
this.mouseClickMove(i, j, this.eventButton, l);
}
if (lastX != i || lastY != j) {
- try {
EnumCursor prevCursor = view.getCurrentCursor();
view.setCursor(EnumCursor.DEFAULT);
this.mouseMove(i, j);
EnumCursor newCursor = view.getCurrentCursor();
+ try {
if (prevCursor != newCursor)
Mouse.setNativeCursor(GLCursors.getCursor(newCursor));
} catch (Throwable e) {
- if (e.getMessage() == null || !e.getMessage().contains("hack to stop"))
e.printStackTrace();
}
}
@@ -272,13 +270,14 @@ public class GuiScreenAdapter extends GuiScreen {
int wheel = Mouse.getEventDWheel();
if (wheel != 0) {
- view.mouseScrolled0(i, j, i, j, wheel);
+ try {
+ view.mouseScrolled0(i, j, i, j, wheel);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
lastX = i;
lastY = j;
- } catch (Throwable e) {
- e.printStackTrace();
- }
}
public void handleKeyboardInput() throws IOException {
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/xml/PropByPropParsedWidgetConverter.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/xml/PropByPropParsedWidgetConverter.java
index 8f6e2feb..32663151 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/xml/PropByPropParsedWidgetConverter.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/guiv2/xml/PropByPropParsedWidgetConverter.java
@@ -81,6 +81,8 @@ public abstract class PropByPropParsedWidgetConverter<W extends Widget, R extend
.getTarget()
.invoke(rootWidget);
exported.setValue(obj);
+ } catch (Error e) {
+ throw e;
} catch (Throwable e) {
throw new RuntimeException(e);
}