[FEATURE] sync updatescache command

This commit is contained in:
Gravita 2024-02-27 15:53:27 +07:00
parent 11382d3465
commit 80176ff1e1
4 changed files with 31 additions and 2 deletions

View File

@ -37,7 +37,6 @@ public class ComponentCommand extends Command {
logger.info("Print help for component:");
logger.info("component unload [componentName]");
logger.info("component load [componentName] [filename]");
logger.info("component gc [componentName]");
}
@Override

View File

@ -11,11 +11,12 @@ public class SyncCommand extends Command {
this.childCommands.put("updates", new SyncUpdatesCommand(server));
this.childCommands.put("up", new SyncUPCommand(server));
this.childCommands.put("launchermodules", new SyncLauncherModulesCommand(server));
this.childCommands.put("updatescache", new SyncUpdatesCacheCommand(server));
}
@Override
public String getArgsDescription() {
return "[updates/profiles/up/binaries/launchermodules] [args...]";
return "[updates/profiles/up/binaries/launchermodules/updatescache] [args...]";
}
@Override

View File

@ -0,0 +1,25 @@
package pro.gravit.launchserver.command.sync;
import pro.gravit.launchserver.LaunchServer;
import pro.gravit.launchserver.command.Command;
public class SyncUpdatesCacheCommand extends Command {
public SyncUpdatesCacheCommand(LaunchServer server) {
super(server);
}
@Override
public String getArgsDescription() {
return null;
}
@Override
public String getUsageDescription() {
return "sync updates cache";
}
@Override
public void invoke(String... args) throws Exception {
server.updatesManager.readUpdatesFromCache();
}
}

View File

@ -52,6 +52,10 @@ public class UpdatesManager {
this.updatesDirMap = Collections.unmodifiableMap(updatesDirMap);
}
public void readUpdatesFromCache() throws IOException {
readCache(cacheFile);
}
public void readUpdatesDir() throws IOException {
if (server.config.cacheUpdates) {
if (Files.exists(cacheFile)) {