OpenInv/src/com/lishid/openinv/utils/UpdateManager.java

34 lines
1 KiB
Java
Raw Normal View History

package com.lishid.openinv.utils;
import java.io.File;
import com.lishid.openinv.OpenInv;
import com.lishid.openinv.utils.Updater.UpdateResult;
import com.lishid.openinv.utils.Updater.UpdateType;
public class UpdateManager
{
public Updater updater;
public void Initialize(OpenInv plugin, File file)
{
updater = new Updater(plugin, OpenInv.logger, "openinv", file);
// Create task to update
2013-03-19 10:36:56 -04:00
plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable()
{
@Override
public void run()
{
// Check for updates
if (OpenInv.GetCheckForUpdates())
{
UpdateResult result = updater.update(UpdateType.DEFAULT);
if (result != UpdateResult.NO_UPDATE)
OpenInv.log(result.toString());
}
}
}, 0, 20 * 60 * 1000); // Update every once a while
}
}