SteamWar/SpigotCore
Archiviert
13
0

Do not log complete server crashes

Dieser Commit ist enthalten in:
Lixfel 2020-01-25 09:20:30 +01:00
Ursprung f3b5838a16
Commit f77604e6ec

Datei anzeigen

@ -6,7 +6,12 @@ import org.bukkit.Bukkit;
public class SWException { public class SWException {
private SWException(){} private SWException(){}
private static boolean logDisabled = true;
public static void log(LogEvent logEvent){ public static void log(LogEvent logEvent){
if(logDisabled)
return;
String server = SQL.disarmString(Bukkit.getWorlds().get(0).getName()); String server = SQL.disarmString(Bukkit.getWorlds().get(0).getName());
StringBuilder stacktrace = new StringBuilder(logEvent.getSource().toString()); StringBuilder stacktrace = new StringBuilder(logEvent.getSource().toString());
@ -24,6 +29,11 @@ public class SWException {
if(message.startsWith("Block at") || message.startsWith("POI data mismatch")) if(message.startsWith("Block at") || message.startsWith("POI data mismatch"))
return; return;
if(message.equals("------------------------------")){
message = "Server stopped responding";
logDisabled = true;
}
SQL.update("INSERT INTO Exception (server, message, stacktrace) VALUES ('" + server + "', '" + SQL.disarmString(message) + "', '" + SQL.disarmString(stacktrace.toString()) + "')"); SQL.update("INSERT INTO Exception (server, message, stacktrace) VALUES ('" + server + "', '" + SQL.disarmString(message) + "', '" + SQL.disarmString(stacktrace.toString()) + "')");
} }
} }