remove deprecated ShutdownReasons.kt

This commit is contained in:
Bixilon 2022-08-16 20:35:07 +02:00
parent 947e09e63b
commit c0e6ff06ba
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
5 changed files with 11 additions and 42 deletions

View File

@ -1,31 +0,0 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft
import de.bixilon.kutil.shutdown.AbstractShutdownReason
@Deprecated("Kutil 1.13")
enum class ShutdownReasons(override val exitCode: Int) : AbstractShutdownReason {
UNKNOWN(1),
REQUESTED_BY_USER(0),
ALL_FINE(0),
CRITICAL_EXCEPTION(1),
NO_ACCOUNT_SELECTED(1),
CLI_WRONG_PARAMETER(1),
CLI_HELP(0),
LAUNCHER_FXML_LOAD_ERROR(1),
;
override val message: String? get() = null
}

View File

@ -20,11 +20,11 @@ import de.bixilon.kutil.exception.ExceptionUtil.tryCatch
import de.bixilon.kutil.file.FileUtil.slashPath
import de.bixilon.kutil.file.watcher.FileWatcherService
import de.bixilon.kutil.os.PlatformInfo
import de.bixilon.kutil.shutdown.AbstractShutdownReason
import de.bixilon.kutil.shutdown.ShutdownManager
import de.bixilon.kutil.time.TimeUtil
import de.bixilon.kutil.unit.UnitFormatter.formatBytes
import de.bixilon.kutil.unsafe.UnsafeUtil
import de.bixilon.minosoft.ShutdownReasons
import de.bixilon.minosoft.gui.eros.controller.JavaFXWindowController
import de.bixilon.minosoft.gui.eros.util.JavaFXInitializer
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil
@ -79,7 +79,7 @@ class ErosCrashReport : JavaFXWindowController() {
}
fun exit() {
ShutdownManager.shutdown(exception?.message, ShutdownReasons.CRITICAL_EXCEPTION)
ShutdownManager.shutdown(exception?.message, AbstractShutdownReason.CRASH)
}
fun hardCrash() {
@ -172,7 +172,7 @@ class ErosCrashReport : JavaFXWindowController() {
}
if (RunConfiguration.DISABLE_EROS) {
ShutdownManager.shutdown(this?.message, ShutdownReasons.CRITICAL_EXCEPTION)
ShutdownManager.shutdown(this?.message, AbstractShutdownReason.CRASH)
return
}
@ -204,7 +204,7 @@ class ErosCrashReport : JavaFXWindowController() {
crashReport.crashReportPath = crashReportPath
crashReport.stage = stage
stage.setOnCloseRequest { ShutdownManager.shutdown(this?.message, ShutdownReasons.CRITICAL_EXCEPTION) }
stage.setOnCloseRequest { ShutdownManager.shutdown(this?.message, AbstractShutdownReason.CRASH) }
stage.show()
}
}

View File

@ -14,8 +14,8 @@
package de.bixilon.minosoft.gui.eros.dialog
import de.bixilon.kutil.latch.CountUpAndDownLatch
import de.bixilon.kutil.shutdown.AbstractShutdownReason
import de.bixilon.kutil.shutdown.ShutdownManager
import de.bixilon.minosoft.ShutdownReasons
import de.bixilon.minosoft.data.text.TranslatableComponents
import de.bixilon.minosoft.gui.eros.controller.DialogController
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil
@ -70,7 +70,7 @@ class StartingDialog(
@FXML
fun exit() {
ShutdownManager.shutdown(reason = ShutdownReasons.REQUESTED_BY_USER)
ShutdownManager.shutdown(reason = AbstractShutdownReason.DEFAULT)
}
companion object {

View File

@ -14,8 +14,8 @@
package de.bixilon.minosoft.gui.eros.main
import de.bixilon.kutil.cast.CastUtil.unsafeCast
import de.bixilon.kutil.shutdown.AbstractShutdownReason
import de.bixilon.kutil.shutdown.ShutdownManager
import de.bixilon.minosoft.ShutdownReasons
import de.bixilon.minosoft.config.profile.delegate.watcher.SimpleProfileDelegateWatcher.Companion.profileWatchFX
import de.bixilon.minosoft.config.profile.profiles.eros.ErosProfileManager
import de.bixilon.minosoft.data.accounts.Account
@ -117,7 +117,7 @@ class MainErosController : JavaFXWindowController() {
clickable()
setOnMouseClicked {
stage.close()
ShutdownManager.shutdown(reason = ShutdownReasons.REQUESTED_BY_USER)
ShutdownManager.shutdown(reason = AbstractShutdownReason.DEFAULT)
}
}
@ -144,7 +144,7 @@ class MainErosController : JavaFXWindowController() {
override fun postInit() {
stage.scene.window.addEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST) {
ShutdownManager.shutdown(reason = ShutdownReasons.REQUESTED_BY_USER)
ShutdownManager.shutdown(reason = AbstractShutdownReason.DEFAULT)
}
}

View File

@ -14,10 +14,10 @@
package de.bixilon.minosoft.terminal.cli
import de.bixilon.kutil.latch.CountUpAndDownLatch
import de.bixilon.kutil.shutdown.AbstractShutdownReason
import de.bixilon.kutil.shutdown.ShutdownManager
import de.bixilon.kutil.watcher.DataWatcher.Companion.observe
import de.bixilon.kutil.watcher.DataWatcher.Companion.watched
import de.bixilon.minosoft.ShutdownReasons
import de.bixilon.minosoft.commands.nodes.RootNode
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
import de.bixilon.minosoft.terminal.commands.Commands
@ -75,7 +75,7 @@ object CLI {
terminal.flush()
ROOT_NODE.execute(line, connection)
} catch (exception: UserInterruptException) {
ShutdownManager.shutdown(reason = ShutdownReasons.ALL_FINE)
ShutdownManager.shutdown(reason = AbstractShutdownReason.DEFAULT)
} catch (exception: Throwable) {
exception.printStackTrace()
}