diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index da0a419e..f71727ed 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -219,6 +219,18 @@ public void init() } public void close() { + try { + LaunchServer.server.unregisterObject("permissionsHandler", permissionsHandler); + for (int i = 0; i < auth.length; ++i) { + AuthProviderPair pair = auth[i]; + LaunchServer.server.unregisterObject("auth.".concat(pair.name).concat(".provider"), pair.provider); + LaunchServer.server.unregisterObject("auth.".concat(pair.name).concat(".handler"), pair.handler); + LaunchServer.server.unregisterObject("auth.".concat(pair.name).concat(".texture"), pair.textureProvider); + } + } catch (Exception e) + { + LogHelper.error(e); + } try { for (AuthProviderPair p : auth) p.close(); } catch (IOException e) { @@ -872,6 +884,20 @@ public void registerObject(String name, Object object) { } } + public void unregisterObject(String name, Object object) { + if (object instanceof Reloadable) { + reloadManager.unregisterReloadable(name); + } + if (object instanceof Reconfigurable) { + reconfigurableManager.unregisterReconfigurable(name); + } + if (object instanceof NeedGarbageCollection) { + GarbageManager.unregisterNeedGC((NeedGarbageCollection) object); + } + if (object instanceof JsonConfigurable) { + + } + } public void fullyRestart() { restart(); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReconfigurableManager.java b/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReconfigurableManager.java index c3133a96..e6247b0a 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReconfigurableManager.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReconfigurableManager.java @@ -14,6 +14,10 @@ public void registerReconfigurable(String name, Reconfigurable reconfigurable) { VerifyHelper.putIfAbsent(RECONFIGURABLE, name.toLowerCase(), Objects.requireNonNull(reconfigurable, "adapter"), String.format("Reloadable has been already registered: '%s'", name)); } + public Reconfigurable unregisterReconfigurable(String name) + { + return RECONFIGURABLE.remove(name); + } public void printHelp(String name) { RECONFIGURABLE.get(name.toLowerCase()).printConfigHelp(); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReloadManager.java b/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReloadManager.java index 95a06e6e..ff56467f 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReloadManager.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/ReloadManager.java @@ -14,6 +14,10 @@ public void registerReloadable(String name, Reloadable reloadable) { VerifyHelper.putIfAbsent(RELOADABLES, name.toLowerCase(), Objects.requireNonNull(reloadable, "adapter"), String.format("Reloadable has been already registered: '%s'", name.toLowerCase())); } + public Reloadable unregisterReloadable(String name) + { + return RELOADABLES.remove(name); + } public void reloadAll() { RELOADABLES.forEach((k, v) -> { diff --git a/modules b/modules index 412ac81c..c3381644 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit 412ac81c5c60b572d4e36ebdb7c2828dbac86876 +Subproject commit c338164496249a17eea2079ed560b09132831f35