Add Engine#shuttingDown field

This commit is contained in:
JeremyStar™ 2024-06-16 15:52:14 +02:00
parent 129537a60c
commit a26c8035c1
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -72,6 +72,14 @@ public final class Engine implements SubsystemMainClass {
@NotNull @NotNull
private LoggerInstance logger; private LoggerInstance logger;
/**
* Indicates if the engine is shutting down.
*
* @since 1-alpha1
*/
@Getter
private boolean shuttingDown = false;
/** /**
* Constructor, initializes the StarOpenSource Engine. * Constructor, initializes the StarOpenSource Engine.
* *
@ -199,6 +207,7 @@ public final class Engine implements SubsystemMainClass {
*/ */
public void shutdown(@Range(from = 0, to = 255) int exitCode) { public void shutdown(@Range(from = 0, to = 255) int exitCode) {
logger.info("Shutting engine down"); logger.info("Shutting engine down");
shuttingDown = true;
logger.verb("Notifiying classes about shutdown"); logger.verb("Notifiying classes about shutdown");
new EngineShutdownEvent().callEvent(); new EngineShutdownEvent().callEvent();
logger.verb("Notifying subsystems about shutdown"); logger.verb("Notifying subsystems about shutdown");