Start update checking immediately:

Initializing the Updater class from the main thread allows the Updater
thread to begin its query before the first server tick, which is when the
scheduled task will begin. Gotta get that update!
This commit is contained in:
mbax
2014-08-04 23:39:04 -04:00
parent b8d557b769
commit 935b8318d1
@@ -136,10 +136,10 @@ public class PlayerVaults extends JavaPlugin {
final PlayerVaults plugin = this; final PlayerVaults plugin = this;
final File file = this.getFile(); final File file = this.getFile();
final Updater.UpdateType updateType = getConfig().getBoolean("download-update", true) ? Updater.UpdateType.DEFAULT : Updater.UpdateType.NO_DOWNLOAD; final Updater.UpdateType updateType = getConfig().getBoolean("download-update", true) ? Updater.UpdateType.DEFAULT : Updater.UpdateType.NO_DOWNLOAD;
final Updater updater = new Updater(plugin, 50123, file, updateType, false);
getServer().getScheduler().runTaskAsynchronously(this, new Runnable() { getServer().getScheduler().runTaskAsynchronously(this, new Runnable() {
@Override @Override
public void run() { public void run() {
Updater updater = new Updater(plugin, 50123, file, updateType, false);
update = updater.getResult() == Updater.UpdateResult.UPDATE_AVAILABLE; update = updater.getResult() == Updater.UpdateResult.UPDATE_AVAILABLE;
name = updater.getLatestName(); name = updater.getLatestName();
if (updater.getResult() == Updater.UpdateResult.SUCCESS) { if (updater.getResult() == Updater.UpdateResult.SUCCESS) {