diff --git a/core/src/io/anuke/mindustry/ctype/Content.java b/core/src/io/anuke/mindustry/ctype/Content.java index 2cd7725970..09a304817d 100644 --- a/core/src/io/anuke/mindustry/ctype/Content.java +++ b/core/src/io/anuke/mindustry/ctype/Content.java @@ -54,9 +54,10 @@ public abstract class Content implements Comparable{ /** 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; } } diff --git a/core/src/io/anuke/mindustry/mod/ContentParser.java b/core/src/io/anuke/mindustry/mod/ContentParser.java index af3d432640..826fada015 100644 --- a/core/src/io/anuke/mindustry/mod/ContentParser.java +++ b/core/src/io/anuke/mindustry/mod/ContentParser.java @@ -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); } diff --git a/gradle.properties b/gradle.properties index fabfd9b669..f236014127 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=2db5436d41081362f15d1cf2175293a521d16e6f +archash=96b64c172da9fed6b23440372fd6c7a081b6ca2e diff --git a/server/src/io/anuke/mindustry/server/ServerLauncher.java b/server/src/io/anuke/mindustry/server/ServerLauncher.java index 9c0e87179f..1210d81606 100644 --- a/server/src/io/anuke/mindustry/server/ServerLauncher.java +++ b/server/src/io/anuke/mindustry/server/ServerLauncher.java @@ -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());