diff options
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index 0d806119f..9025703f5 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -187,10 +187,7 @@ class ConfigManager { run() } catch (e: Throwable) { e.printStackTrace() - println("This is a crash.") - while (true) { - // If you know the forge method to shut down correctly, please quietly pr it. - } + LorenzUtils.shutdownMinecraft("Config is corrupt inside developement enviroment.") } } else { run() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 8ed5de686..7f5759a70 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -25,6 +25,7 @@ import net.minecraft.event.ClickEvent import net.minecraft.event.HoverEvent import net.minecraft.launchwrapper.Launch import net.minecraft.util.ChatComponentText +import net.minecraftforge.fml.common.FMLCommonHandler import java.awt.Color import java.lang.reflect.Field import java.lang.reflect.Modifier @@ -490,7 +491,7 @@ object LorenzUtils { } } - fun List<String>.nextAfter(after: String, skip: Int = 1) = nextAfter({ it == after}, skip) + fun List<String>.nextAfter(after: String, skip: Int = 1) = nextAfter({ it == after }, skip) fun List<String>.nextAfter(after: (String) -> Boolean, skip: Int = 1): String? { var missing = -1 @@ -628,4 +629,12 @@ object LorenzUtils { ?: kotlin.error("Unknown enum constant for ${enumValues<T>().first().name.javaClass.simpleName}: '$name'") fun isInDevEnviromen() = Launch.blackboard.get("fml.deobfuscatedEnvironment") as Boolean + + fun shutdownMinecraft(reason: String? = null) { + System.err.println("SkyHanni-${SkyHanniMod.version} forced the game to shutdown.") + reason?.let { + System.err.println("Reason: $it") + } + FMLCommonHandler.instance().handleExit(-1) + } } |