diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/modules/impl/LaunchServerCoreModule.java b/LaunchServer/src/main/java/pro/gravit/launchserver/modules/impl/LaunchServerCoreModule.java index 2a1da839..c816d073 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/modules/impl/LaunchServerCoreModule.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/modules/impl/LaunchServerCoreModule.java @@ -3,7 +3,7 @@ import pro.gravit.launcher.modules.LauncherInitContext; import pro.gravit.launcher.modules.LauncherModule; import pro.gravit.launcher.modules.LauncherModuleInfo; -import pro.gravit.launchserver.modules.events.LaunchServerInitPhase; +import pro.gravit.launcher.modules.events.InitPhase; import pro.gravit.utils.Version; import pro.gravit.utils.helper.LogHelper; @@ -14,11 +14,11 @@ public LaunchServerCoreModule() { @Override public void init(LauncherInitContext initContext) { - registerEvent(this::testEvent, LaunchServerInitPhase.class); + registerEvent(this::testEvent, InitPhase.class); } - public void testEvent(LaunchServerInitPhase event) + public void testEvent(InitPhase event) { - LogHelper.debug("[LaunchServerCore] Event LaunchServerInitPhase passed"); + //LogHelper.debug("[LaunchServerCore] Event LaunchServerInitPhase passed"); } } diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/modules/LauncherModule.java b/LauncherAPI/src/main/java/pro/gravit/launcher/modules/LauncherModule.java index 9ed1b65d..3f197446 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/modules/LauncherModule.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/modules/LauncherModule.java @@ -10,7 +10,7 @@ public abstract class LauncherModule { protected LauncherModulesManager modulesManager; protected final LauncherModuleInfo moduleInfo; protected ModulesConfigManager modulesConfigManager; - protected InitPhase initPhase = InitPhase.CREATED; + protected InitStatus initStatus = InitStatus.CREATED; protected LauncherModule() { moduleInfo = new LauncherModuleInfo("UnknownModule"); @@ -24,7 +24,7 @@ public LauncherModuleInfo getModuleInfo() { return moduleInfo; } - public enum InitPhase + public enum InitStatus { CREATED, INIT, @@ -49,12 +49,12 @@ public Event cancel() { protected boolean cancel = false; } - public InitPhase getInitPhase() { - return initPhase; + public InitStatus getInitStatus() { + return initStatus; } - public LauncherModule setInitPhase(InitPhase initPhase) { - this.initPhase = initPhase; + public LauncherModule setInitStatus(InitStatus initStatus) { + this.initStatus = initStatus; return this; } diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/modules/impl/SimpleModuleManager.java b/LauncherAPI/src/main/java/pro/gravit/launcher/modules/impl/SimpleModuleManager.java index b6694be4..d80d3884 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/modules/impl/SimpleModuleManager.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/modules/impl/SimpleModuleManager.java @@ -67,13 +67,13 @@ public void initModules(LauncherInitContext initContext) { isAnyModuleLoad = false; for(LauncherModule module : modules) { - if(!module.getInitPhase().equals(LauncherModule.InitPhase.CREATED)) continue; + if(!module.getInitStatus().equals(LauncherModule.InitStatus.CREATED)) continue; if(checkDepend(module)) { isAnyModuleLoad = true; - module.setInitPhase(LauncherModule.InitPhase.INIT); + module.setInitStatus(LauncherModule.InitStatus.INIT); module.init(initContext); - module.setInitPhase(LauncherModule.InitPhase.FINISH); + module.setInitStatus(LauncherModule.InitStatus.FINISH); loaded++; } } @@ -81,13 +81,13 @@ public void initModules(LauncherInitContext initContext) { } for(LauncherModule module : modules) { - if(module.getInitPhase().equals(LauncherModule.InitPhase.CREATED)) + if(module.getInitStatus().equals(LauncherModule.InitStatus.CREATED)) { LauncherModuleInfo info = module.getModuleInfo(); LogHelper.warning("Module %s required %s. Cyclic dependencies?", info.name, Arrays.toString(info.dependencies)); - module.setInitPhase(LauncherModule.InitPhase.INIT); + module.setInitStatus(LauncherModule.InitStatus.INIT); module.init(initContext); - module.setInitPhase(LauncherModule.InitPhase.FINISH); + module.setInitStatus(LauncherModule.InitStatus.FINISH); } } } @@ -99,7 +99,7 @@ private boolean checkDepend(LauncherModule module) { LauncherModule depModule = getModule(dep); if(depModule == null) throw new RuntimeException(String.format("Module %s required %s. %s not found", info.name, dep, dep)); - if(depModule.getInitPhase().equals(LauncherModule.InitPhase.CREATED)) return false; + if(depModule.getInitStatus().equals(LauncherModule.InitStatus.CREATED)) return false; } return true; }