Newer
Older
KeeperJerry_Launcher / LaunchServer / source / command / hash / SyncUpdatesCommand.java
@sashok724 sashok724 on 2 Dec 2016 983 bytes перед тем как начать
package launchserver.command.hash;

import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import launcher.helper.LogHelper;
import launchserver.LaunchServer;
import launchserver.command.Command;

public final class SyncUpdatesCommand extends Command {
    public SyncUpdatesCommand(LaunchServer server) {
        super(server);
    }

    @Override
    public String getArgsDescription() {
        return "[subdirs...]";
    }

    @Override
    public String getUsageDescription() {
        return "Resync updates dir";
    }

    @Override
    public void invoke(String... args) throws IOException {
        Set<String> dirs = null;
        if (args.length > 0) { // Hash all updates dirs
            dirs = new HashSet<>(args.length);
            Collections.addAll(dirs, args);
        }

        // Hash updates dir
        server.syncUpdatesDir(dirs);
        LogHelper.subInfo("Updates dir successfully resynced");
    }
}