This commit is contained in:
Anuken 2019-12-15 19:35:04 -05:00
parent 9f3dcdf727
commit 53aedcee2c
2 changed files with 10 additions and 59 deletions

View file

@ -1,57 +0,0 @@
package io.anuke.mindustry.mod;
public class ModCrashHandler{
public static void handle(Throwable t){
/*
Array<Throwable> 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);
}*/
}
}

View file

@ -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;