Skip to content

Commit

Permalink
run update if possible on late init
Browse files Browse the repository at this point in the history
  • Loading branch information
burdoto committed May 9, 2024
1 parent a0834a8 commit de28103
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/core/main/java/org/comroid/mcsd/core/ServerManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.comroid.mcsd.core.module.internal.side.hub.EventsFromRabbitModule;
import org.comroid.mcsd.core.module.player.PlayerEventModule;
import org.comroid.mcsd.core.module.remote.ssh.SshFileModule;
import org.comroid.mcsd.core.module.status.UpdateModule;
import org.comroid.mcsd.core.repo.module.ModuleRepo;
import org.comroid.mcsd.core.repo.server.ServerRepo;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -160,9 +161,14 @@ <T extends ServerModule<?>> void loadIfAbsent(Class<T> type, Supplier<T> supplie
@Override
@SneakyThrows
protected void $initialize() {
if (sideConfig.getSide() != ModuleType.Side.Agent)
return;
updateProperties().get();
if (sideConfig.getSide() == ModuleType.Side.Agent)
updateProperties().get();
}

@Override
protected void $lateInitialize() {
if (sideConfig.getSide() == ModuleType.Side.Agent)
component(UpdateModule.class).ifPresent(module -> module.runUpdate(false));
}

public AlmostComplete<Properties> updateProperties() throws IOException {
Expand Down

0 comments on commit de28103

Please sign in to comment.