Fixed #7469
This commit is contained in:
@@ -4452,10 +4452,10 @@ public class Blocks{
|
|||||||
trailLength = 18;
|
trailLength = 18;
|
||||||
missileAccelTime = 50f;
|
missileAccelTime = 50f;
|
||||||
lowAltitude = true;
|
lowAltitude = true;
|
||||||
//targetAir = false;
|
|
||||||
loopSound = Sounds.missileTrail;
|
loopSound = Sounds.missileTrail;
|
||||||
loopSoundVolume = 0.6f;
|
loopSoundVolume = 0.6f;
|
||||||
deathSound = Sounds.largeExplosion;
|
deathSound = Sounds.largeExplosion;
|
||||||
|
targetAir = false;
|
||||||
|
|
||||||
fogRadius = 6f;
|
fogRadius = 6f;
|
||||||
|
|
||||||
|
|||||||
@@ -87,78 +87,18 @@ public class CrashSender{
|
|||||||
try{
|
try{
|
||||||
File file = new File(OS.getAppDataDirectoryString(Vars.appName), "crashes/crash-report-" + new SimpleDateFormat("MM_dd_yyyy_HH_mm_ss").format(new Date()) + ".txt");
|
File file = new File(OS.getAppDataDirectoryString(Vars.appName), "crashes/crash-report-" + new SimpleDateFormat("MM_dd_yyyy_HH_mm_ss").format(new Date()) + ".txt");
|
||||||
new Fi(OS.getAppDataDirectoryString(Vars.appName)).child("crashes").mkdirs();
|
new Fi(OS.getAppDataDirectoryString(Vars.appName)).child("crashes").mkdirs();
|
||||||
new Fi(file).writeString(createReport(parseException(exception)));
|
new Fi(file).writeString(createReport(writeException(exception)));
|
||||||
writeListener.get(file);
|
writeListener.get(file);
|
||||||
}catch(Throwable e){
|
}catch(Throwable e){
|
||||||
Log.err("Failed to save local crash report.", e);
|
Log.err("Failed to save local crash report.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
|
||||||
//check crash report setting
|
|
||||||
if(!Core.settings.getBool("crashreport", true)){
|
|
||||||
ret();
|
|
||||||
}
|
|
||||||
}catch(Throwable ignored){
|
|
||||||
//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()){
|
|
||||||
ret();
|
|
||||||
}
|
|
||||||
}catch(Throwable ignored){
|
|
||||||
}
|
|
||||||
|
|
||||||
//do not send exceptions that occur for versions that can't be parsed
|
|
||||||
if(Version.number == 0){
|
|
||||||
ret();
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean netActive = false, netServer = false;
|
|
||||||
|
|
||||||
//attempt to close connections, if applicable
|
//attempt to close connections, if applicable
|
||||||
try{
|
try{
|
||||||
netActive = net.active();
|
|
||||||
netServer = net.server();
|
|
||||||
net.dispose();
|
net.dispose();
|
||||||
}catch(Throwable ignored){
|
}catch(Throwable ignored){
|
||||||
}
|
}
|
||||||
|
|
||||||
//disabled until further notice.
|
|
||||||
/*
|
|
||||||
|
|
||||||
JsonValue value = new JsonValue(ValueType.object);
|
|
||||||
|
|
||||||
boolean fn = netActive, fs = netServer;
|
|
||||||
|
|
||||||
//add all relevant info, ignoring exceptions
|
|
||||||
ex(() -> value.addChild("versionType", new JsonValue(Version.type)));
|
|
||||||
ex(() -> value.addChild("versionNumber", new JsonValue(Version.number)));
|
|
||||||
ex(() -> value.addChild("versionModifier", new JsonValue(Version.modifier)));
|
|
||||||
ex(() -> value.addChild("build", new JsonValue(Version.build)));
|
|
||||||
ex(() -> value.addChild("revision", new JsonValue(Version.revision)));
|
|
||||||
ex(() -> value.addChild("net", new JsonValue(fn)));
|
|
||||||
ex(() -> value.addChild("server", new JsonValue(fs)));
|
|
||||||
ex(() -> value.addChild("players", new JsonValue(Groups.player.size())));
|
|
||||||
ex(() -> value.addChild("state", new JsonValue(Vars.state.getState().name())));
|
|
||||||
ex(() -> value.addChild("os", new JsonValue(OS.osName + " x" + OS.osArchBits + " " + OS.osVersion)));
|
|
||||||
ex(() -> value.addChild("trace", new JsonValue(parseException(exception))));
|
|
||||||
ex(() -> value.addChild("javaVersion", new JsonValue(OS.javaVersion)));
|
|
||||||
ex(() -> value.addChild("javaArch", new JsonValue(OS.osArchBits)));
|
|
||||||
|
|
||||||
Log.info("Sending crash report.");
|
|
||||||
|
|
||||||
//post to crash report URL, exit code indicates send success
|
|
||||||
Http.post(Vars.crashReportURL, value.toJson(OutputType.json)).error(t -> {
|
|
||||||
Log.info("Crash report not sent.");
|
|
||||||
System.exit(-1);
|
|
||||||
}).block(r -> {
|
|
||||||
Log.info("Crash sent successfully.");
|
|
||||||
System.exit(1);
|
|
||||||
});*/
|
|
||||||
|
|
||||||
ret();
|
|
||||||
}catch(Throwable death){
|
}catch(Throwable death){
|
||||||
death.printStackTrace();
|
death.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -170,17 +110,10 @@ public class CrashSender{
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String parseException(Throwable e){
|
private static String writeException(Throwable e){
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
PrintWriter pw = new PrintWriter(sw);
|
PrintWriter pw = new PrintWriter(sw);
|
||||||
e.printStackTrace(pw);
|
e.printStackTrace(pw);
|
||||||
return sw.toString();
|
return sw.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ex(Runnable r){
|
|
||||||
try{
|
|
||||||
r.run();
|
|
||||||
}catch(Throwable ignored){
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user