mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FEATURE] Возможность дерегистрации Reconfigurable/Reloadable
This commit is contained in:
parent
bb27559314
commit
701878bcf4
4 changed files with 35 additions and 1 deletions
|
@ -219,6 +219,18 @@ public void init()
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
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 {
|
try {
|
||||||
for (AuthProviderPair p : auth) p.close();
|
for (AuthProviderPair p : auth) p.close();
|
||||||
} catch (IOException e) {
|
} 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() {
|
public void fullyRestart() {
|
||||||
restart();
|
restart();
|
||||||
|
|
|
@ -14,6 +14,10 @@ public void registerReconfigurable(String name, Reconfigurable reconfigurable) {
|
||||||
VerifyHelper.putIfAbsent(RECONFIGURABLE, name.toLowerCase(), Objects.requireNonNull(reconfigurable, "adapter"),
|
VerifyHelper.putIfAbsent(RECONFIGURABLE, name.toLowerCase(), Objects.requireNonNull(reconfigurable, "adapter"),
|
||||||
String.format("Reloadable has been already registered: '%s'", name));
|
String.format("Reloadable has been already registered: '%s'", name));
|
||||||
}
|
}
|
||||||
|
public Reconfigurable unregisterReconfigurable(String name)
|
||||||
|
{
|
||||||
|
return RECONFIGURABLE.remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
public void printHelp(String name) {
|
public void printHelp(String name) {
|
||||||
RECONFIGURABLE.get(name.toLowerCase()).printConfigHelp();
|
RECONFIGURABLE.get(name.toLowerCase()).printConfigHelp();
|
||||||
|
|
|
@ -14,6 +14,10 @@ public void registerReloadable(String name, Reloadable reloadable) {
|
||||||
VerifyHelper.putIfAbsent(RELOADABLES, name.toLowerCase(), Objects.requireNonNull(reloadable, "adapter"),
|
VerifyHelper.putIfAbsent(RELOADABLES, name.toLowerCase(), Objects.requireNonNull(reloadable, "adapter"),
|
||||||
String.format("Reloadable has been already registered: '%s'", name.toLowerCase()));
|
String.format("Reloadable has been already registered: '%s'", name.toLowerCase()));
|
||||||
}
|
}
|
||||||
|
public Reloadable unregisterReloadable(String name)
|
||||||
|
{
|
||||||
|
return RELOADABLES.remove(name);
|
||||||
|
}
|
||||||
|
|
||||||
public void reloadAll() {
|
public void reloadAll() {
|
||||||
RELOADABLES.forEach((k, v) -> {
|
RELOADABLES.forEach((k, v) -> {
|
||||||
|
|
2
modules
2
modules
|
@ -1 +1 @@
|
||||||
Subproject commit 412ac81c5c60b572d4e36ebdb7c2828dbac86876
|
Subproject commit c338164496249a17eea2079ed560b09132831f35
|
Loading…
Reference in a new issue