From 53aedcee2c3d007875f68c19165b6ebd29e9b5a8 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 15 Dec 2019 19:35:04 -0500 Subject: [PATCH] Cleanup --- .../anuke/mindustry/mod/ModCrashHandler.java | 57 ------------------- .../io/anuke/mindustry/net/CrashSender.java | 12 +++- 2 files changed, 10 insertions(+), 59 deletions(-) delete mode 100644 core/src/io/anuke/mindustry/mod/ModCrashHandler.java diff --git a/core/src/io/anuke/mindustry/mod/ModCrashHandler.java b/core/src/io/anuke/mindustry/mod/ModCrashHandler.java deleted file mode 100644 index 507057acad..0000000000 --- a/core/src/io/anuke/mindustry/mod/ModCrashHandler.java +++ /dev/null @@ -1,57 +0,0 @@ -package io.anuke.mindustry.mod; - -public class ModCrashHandler{ - - public static void handle(Throwable t){ - /* - Array list = Strings.getCauses(t); - Throwable modCause = list.find(e -> e instanceof ModLoadException); - - if(modCause != null && Fonts.outline != null){ - String text = "[scarlet][[A fatal crash has occured while loading a mod!][]\n\nReason:[accent] " + modCause.getMessage(); - String bottom = "[scarlet]The associated mod has been disabled. Swipe out of the app and launch it again."; - GlyphLayout layout = new GlyphLayout(); - Core.atlas = TextureAtlas.blankAtlas(); - Colors.put("accent", Pal.accent); - - Core.app.addListener(new ApplicationListener(){ - @Override - public void update(){ - Core.graphics.clear(0.1f, 0.1f, 0.1f, 1f); - float rad = Math.min(Core.graphics.getWidth(), Core.graphics.getHeight()) / 2f / 1.3f; - Draw.color(Color.scarlet, Color.black, Mathf.absin(Core.graphics.getFrameId(), 15f, 0.6f)); - Lines.stroke(Scl.scl(40f)); - //Lines.poly2(Core.graphics.getWidth()/2f, Core.graphics.getHeight()/2f, 3, rad, 0f); - float cx = Core.graphics.getWidth()/2f, cy = Core.graphics.getHeight()/2f; - for(int i = 0; i < 3; i++){ - float angle1 = i * 120f + 90f; - float angle2 = (i + 1) * 120f + 90f; - Tmp.v1.trnsExact(angle1, rad - Lines.getStroke()/2f).add(cx, cy); - Tmp.v2.trnsExact(angle2, rad - Lines.getStroke()/2f).add(cx, cy); - Tmp.v3.trnsExact(angle1, rad + Lines.getStroke()/2f).add(cx, cy); - Tmp.v4.trnsExact(angle2, rad + Lines.getStroke()/2f).add(cx, cy); - Fill.quad(Tmp.v1.x, Tmp.v1.y, Tmp.v2.x, Tmp.v2.y, Tmp.v4.x, Tmp.v4.y, Tmp.v3.x, Tmp.v3.y); - } - Lines.lineAngleCenter(Core.graphics.getWidth()/2f, Core.graphics.getHeight()/2f - Scl.scl(5f), 90f, rad/3.1f); - Fill.square(Core.graphics.getWidth()/2f, Core.graphics.getHeight()/2f + rad/2f - Scl.scl(15f), Lines.getStroke()/2f); - Draw.reset(); - - Fonts.outline.getData().markupEnabled = true; - layout.setText(Fonts.outline, text, Color.white, Core.graphics.getWidth(), Align.left, true); - Fonts.outline.draw(text, Core.graphics.getWidth()/2f - layout.width/2f, Core.graphics.getHeight() - Scl.scl(50f), Core.graphics.getWidth(), Align.left, true); - - layout.setText(Fonts.outline, bottom, Color.white, Core.graphics.getWidth(), Align.left, true); - Fonts.outline.draw(bottom, Core.graphics.getWidth()/2f - layout.width/2f, layout.height + Scl.scl(10f), Core.graphics.getWidth(), Align.left, true); - Draw.flush(); - } - - @Override - public void resize(int width, int height){ - Draw.proj().setOrtho(0, 0, width, height); - } - }); - }else{ - throw new RuntimeException(t); - }*/ - } -} diff --git a/core/src/io/anuke/mindustry/net/CrashSender.java b/core/src/io/anuke/mindustry/net/CrashSender.java index 21b12bf3d8..1c51f04154 100644 --- a/core/src/io/anuke/mindustry/net/CrashSender.java +++ b/core/src/io/anuke/mindustry/net/CrashSender.java @@ -44,8 +44,8 @@ public class CrashSender{ }else{ Version.build = Strings.canParseInt(map.get("build")) ? Integer.parseInt(map.get("build")) : -1; } - }catch(Throwable ignored){ - ignored.printStackTrace(); + }catch(Throwable e){ + e.printStackTrace(); Log.err("Failed to parse version."); } } @@ -69,6 +69,14 @@ public class CrashSender{ //if there's no settings init we don't know what the user wants but chances are it's an important crash, so send it anyway } + try{ + //check any mods - if there are any, don't send reports + if(Vars.mods != null && !Vars.mods.list().isEmpty()){ + return; + } + }catch(Throwable ignored){ + } + //do not send exceptions that occur for versions that can't be parsed if(Version.number == 0){ return;