Skip to content

Commit 9dbcb56

Browse files
committed
fix: config fix not working outside dev environment
1 parent 06b9175 commit 9dbcb56

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/main/kotlin/com/github/itsempa/nautilus/config/core/loader/ConfigMapper.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@ object ConfigMapper : DataMapper<Features> {
2222
val newJson = NautilusConfigMigrator.fixConfig(jsonObject)
2323

2424
val run = { gson.fromJson<Features>(newJson) }
25-
if (PlatformUtils.isDevEnvironment) {
25+
return if (PlatformUtils.isDevEnvironment) {
2626
try {
27-
return run()
27+
run()
2828
} catch (e: Throwable) {
2929
Nautilus.consoleLog(e.stackTraceToString())
3030
McClient.shutdown("Nautilus Config is corrupt inside development environment.")
3131
}
3232
} else run()
33-
return gson.fromJson<Features>(string)
3433
}
3534
}
3635
}

src/main/kotlin/com/github/itsempa/nautilus/utils/helpers/McClient.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ object McClient {
3232
else DelayedRun.runNextTick(action)
3333
}
3434

35-
fun shutdown(reason: String? = null) {
35+
fun shutdown(reason: String? = null): Nothing {
3636
val reasonLine = reason?.let { " Reason: ($it)" }.orEmpty()
37-
System.err.println("${Nautilus.MOD_NAME}-${Nautilus.VERSION} forced the game to shutdown.$reasonLine")
37+
val message = "${Nautilus.MOD_NAME}-${Nautilus.VERSION} forced the game to shutdown.$reasonLine"
38+
System.err.println(message)
3839
FMLCommonHandler.instance().handleExit(-1)
40+
throw RuntimeException(message) // This is here so that shutdown can return "Nothing"
3941
}
4042

4143
}

0 commit comments

Comments
 (0)