All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.guizhanss.guizhanlibplugin.updater.universal.v2.UniversalUpdater Maven / Gradle / Ivy

package net.guizhanss.guizhanlibplugin.updater.universal.v2;

import lombok.Getter;
import net.guizhanss.guizhanlib.updater.UpdaterConfig;
import net.guizhanss.guizhanlibplugin.GuizhanLibPlugin;
import org.bukkit.plugin.Plugin;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * This is a universal updater. It will put all the updater tasks in a queue and execute them one by one.
 *
 * @author ybw0014
 */
@Getter
public final class UniversalUpdater {
    private final List records = new ArrayList<>();

    public void add(Plugin plugin, File file, String githubUser, String githubRepo, String githubBranch,
                    UpdaterConfig updaterConfig) {
        records.add(new UpdaterRecord(plugin, file, githubUser, githubRepo, githubBranch, updaterConfig));
    }

    public void start() {
        GuizhanLibPlugin.getScheduler().runAsync(new UniversalUpdaterTask(this));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy