Fixed a bug with the auto-updater.

This commit is contained in:
sigonasr2 2016-07-06 22:03:17 -05:00
parent e76bee1a68
commit de419ab869
3 changed files with 7 additions and 5 deletions

Binary file not shown.

View File

@ -21,9 +21,11 @@ import org.bukkit.configuration.file.YamlConfiguration;
public class AutoUpdatePlugin implements Runnable {
List<Plugin> plugins;
boolean restarting=false;
org.bukkit.plugin.Plugin plug=null;
public AutoUpdatePlugin() {
public AutoUpdatePlugin(org.bukkit.plugin.Plugin plug) {
plugins = new ArrayList<Plugin>();
this.plug=plug;
}
@Override
@ -58,19 +60,19 @@ public class AutoUpdatePlugin implements Runnable {
}
}
if (restarting) {
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
Bukkit.getScheduler().scheduleSyncDelayedTask(plug, new Runnable() {
@Override
public void run() {
Bukkit.broadcastMessage(ChatColor.YELLOW+"The server is restarting in 1 minute for a plugin update!");
}
},20*120);
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
Bukkit.getScheduler().scheduleSyncDelayedTask(plug, new Runnable() {
@Override
public void run() {
Bukkit.broadcastMessage(ChatColor.RED+"The server is restarting in 10 seconds!");
}
},20*170);
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
Bukkit.getScheduler().scheduleSyncDelayedTask(plug, new Runnable() {
@Override
public void run() {
Bukkit.savePlayers();

View File

@ -267,7 +267,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
TwosideRecyclingCenter.loadConfig();
log("Recycling Centers Loaded: "+TwosideRecyclingCenter.getNumberOfNodes(),3);
pluginupdater = new AutoUpdatePlugin();
pluginupdater = new AutoUpdatePlugin(this);
pluginupdater.AddPlugin("TwosideKeeper", "https://github.com/sigonasr2/TwosideKeeper/raw/master/TwosideKeeper.jar");
pluginupdater.AddPlugin("aPlugin", "https://dl.dropboxusercontent.com/u/62434995/aPlugin.jar");