actually fix update checker not scheduled yet error on fast shutdowns

This commit is contained in:
Pyrbu 2024-01-04 19:55:27 +01:00
parent 3bfea0a004
commit c560fe597e
2 changed files with 5 additions and 3 deletions

@ -148,8 +148,10 @@ public class ZNpcsPlus {
log(ChatColor.WHITE + " * Starting tasks...");
if (configManager.getConfig().checkForUpdates()) {
UpdateChecker updateChecker = new UpdateChecker(getDescription());
scheduler.runDelayedTimerAsync(updateChecker, 5L, 6000L);
shutdownTasks.add(updateChecker::shutdown);
scheduler.runLaterAsync(() -> {
scheduler.runDelayedTimerAsync(updateChecker, 0L, 6000L);
shutdownTasks.add(updateChecker::shutdown);
}, 5L);
pluginManager.registerEvents(new UpdateNotificationListener(this, adventure, updateChecker, scheduler), bootstrap);
}

@ -41,7 +41,7 @@ public class UpdateChecker extends BukkitRunnable {
}
public void shutdown() {
if (getTaskId() != -1) cancel();
cancel();
}
private int versionToNumber(String version) {