add auto update repo while onEnable...

Signed-off-by: j502647092 <jtb1@163.com>
dev
j502647092 2015-10-07 13:39:06 +08:00
parent 88cec09019
commit 38f1a66465
2 changed files with 12 additions and 2 deletions

View File

@ -59,6 +59,7 @@ public class Yum extends JavaPlugin {
this.initCommands();
yumgr = new YumManager(this);
YumManager.repo.jsonToCache(config);
YumManager.updaterepo();
new VersionChecker(this);
try {
final Metrics metrics = new Metrics(this);

View File

@ -18,10 +18,10 @@ public class YumManager {
public static PluginsManager plugman;
public static RepositoryManager repo;
Plugin plugin;
protected static Plugin plugin;
public YumManager(final Plugin plugin) {
this.plugin = plugin;
YumManager.plugin = plugin;
plugman = new PluginsManager(plugin);
download = new DownloadManager(plugin);
repo = new RepositoryManager(plugin);
@ -65,4 +65,13 @@ public class YumManager {
}
return false;
}
public static void updaterepo() {
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
repo.updateRepositories(Bukkit.getConsoleSender());
}
});
}
}