Add initialization & final shutdown message

This commit is contained in:
JeremyStar™ 2024-12-20 01:38:22 +01:00
parent e4f4ab6f8c
commit 8913f5a678
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -151,6 +151,24 @@ class Engine private constructor() {
info = BuildInformation(loadPrefix = "sosengine-base")
state = State.INITIALIZED
// Print initialization message
logger.info("""
_ _
___ ___ ___ / \\___ _ __ __ _(_)_ __ ___
/ __|/ _ \/ __| / / _ \ '_ \ / _` | | '_ \ / _ \
\__ \ (_) \__ \/\_/ __/ | | | (_| | | | | | __/
|___/\___/|___/\/ \___|_| |_|\__, |_|_| |_|\___|
The StarOpenSource Engine |___/ ${info?.versionString(semver = false) ?: ""}
Welcome to the StarOpenSource Engine!
The engine is licensed under the GNU General Public
License v3 and is developed by our wonderful contributors
under the umbrella of the StarOpenSource Project.
Consider contributing!
https://git.staropensource.de/StarOpenSource/Engine
""".trimIndent().trimEnd())
} catch (exception: Exception) {
logger.crash("Engine failed to initialize", throwable = exception, fatal = true)
throw EngineInitializationFailureException(exception)
@ -274,12 +292,27 @@ class Engine private constructor() {
@JvmStatic
private fun performShutdown(final: Boolean, crashed: Boolean = false) {
state = State.SHUTTING_DOWN
val infoLocal: BuildInformation? = info
// Run shutdown code
Environment.unset()
FileAccess.deleteScheduled()
FileAccess.unsetDefaultPaths()
info = null
// Print shutdown message
if (final)
logger.info("""
_ _
___ ___ ___ / \\___ _ __ __ _(_)_ __ ___
/ __|/ _ \/ __| / / _ \ '_ \ / _` | | '_ \ / _ \
\__ \ (_) \__ \/\_/ __/ | | | (_| | | | | | __/
|___/\___/|___/\/ \___|_| |_|\__, |_|_| |_|\___|
The StarOpenSource Engine |___/ ${infoLocal?.versionString(semver = false) ?: ""}
Thank you for using the StarOpenSource Engine!
- The StarOpenSource Project & all engine contributors
""".trimIndent().trimEnd())
}
}