Refactor UpdaterCheckerTask

Update checking/downloading/installing can now be configured precisely and more intuitive in the config.
This commit is contained in:
Frank van der Heijden 2021-01-30 14:41:37 +01:00
parent 1fde72e522
commit b46f6fbb1f
No known key found for this signature in database
GPG key ID: 26DA56488D314D11
18 changed files with 395 additions and 302 deletions

View file

@ -1,12 +1,12 @@
package net.frankheijden.serverutils.common;
import net.frankheijden.serverutils.common.config.Config;
import net.frankheijden.serverutils.common.entities.ServerUtilsPlugin;
import net.frankheijden.serverutils.common.tasks.UpdateCheckerTask;
public class ServerUtilsApp<T> {
public static final int BSTATS_METRICS_ID = 7790;
public static final String VERSION = "{version}";
private final T platformPlugin;
private final ServerUtilsPlugin plugin;
@ -28,9 +28,7 @@ public class ServerUtilsApp<T> {
* Tries checking for updates if enabled by the config.
*/
public static void tryCheckForUpdates() {
if (Config.getInstance().getConfig().getBoolean("settings.check-updates")) {
UpdateCheckerTask.start(getPlugin().getChatProvider().getConsoleSender(), true);
}
UpdateCheckerTask.tryStart(getPlugin().getChatProvider().getConsoleSender(), "boot");
}
public static ServerUtilsPlugin getPlugin() {