Added server mod error check

This commit is contained in:
Anuken 2019-12-17 10:58:43 -05:00
parent 8d921199fb
commit 26881fbdb9
4 changed files with 20 additions and 3 deletions

View File

@ -54,9 +54,10 @@ public abstract class Content implements Comparable<Content>{
/** The mod that loaded this piece of content. */
public @Nullable LoadedMod mod;
/** File that this content was loaded from. */
public @Nullable
Fi sourceFile;
public @Nullable Fi sourceFile;
/** The error that occurred during loading, if applicable. Null if no error occurred. */
public @Nullable String error;
/** Base throwable that caused the error. */
public @Nullable Throwable baseError;
}
}

View File

@ -437,6 +437,7 @@ public class ContentParser{
content.minfo.mod = mod;
content.minfo.sourceFile = file;
content.minfo.error = makeError(error, file);
content.minfo.baseError = error;
if(mod != null){
mod.erroredContent.add(content);
}

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=2db5436d41081362f15d1cf2175293a521d16e6f
archash=96b64c172da9fed6b23440372fd6c7a081b6ca2e

View File

@ -7,8 +7,10 @@ import io.anuke.arc.files.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.*;
import io.anuke.mindustry.core.*;
import io.anuke.mindustry.ctype.*;
import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.mod.*;
import io.anuke.mindustry.mod.Mods.*;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.net.*;
@ -58,6 +60,19 @@ public class ServerLauncher implements ApplicationListener{
mods.loadScripts();
content.createModContent();
content.init();
if(mods.hasContentErrors()){
Log.err("Error occurred loading mod content:");
for(LoadedMod mod : mods.list()){
if(mod.hasContentErrors()){
Log.err("| &ly[{0}]", mod.name);
for(Content cont : mod.erroredContent){
Log.err("| | &y{0}: &c{1}", cont.minfo.sourceFile.name(), Strings.getSimpleMessage(cont.minfo.baseError).replace("\n", " "));
}
}
}
Log.err("The server will now exit.");
System.exit(1);
}
Core.app.addListener(logic = new Logic());
Core.app.addListener(netServer = new NetServer());