If all players leave during a plugin update, the server restarts.

This commit is contained in:
sigonasr2 2016-07-15 10:52:36 -05:00
parent 431eb48b22
commit f95737fa1e
4 changed files with 11 additions and 2 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.5.4
version: 3.5.4r1
commands:
money:
description: Tells the player the amount of money they are holding.

View File

@ -75,7 +75,7 @@ public class AutoUpdatePlugin implements Runnable {
plugins.get(i).hash = md5;
SaveHash(plugins.get(i));
DiscordMessageSender.sendItalicizedRawMessageDiscord("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(i).name+". The server will restart in 3 minutes!");
Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(i).name+". The server will restart in 3 minutes!");
Bukkit.broadcastMessage("The server has detected a new version of "+ChatColor.YELLOW+plugins.get(i).name+". The server will restart in 3 minutes!\n\n"+ChatColor.GRAY+ChatColor.ITALIC+"If all players leave, the update will occur immediately.");
//Move the file to the new location.
/*try {
FileUtils.copyFile(new File(TwosideKeeper.filesave,"updates/"+plugins.get(i).name),

View File

@ -1102,6 +1102,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
if (Bukkit.getOnlinePlayers().size()==1 && restarting_server) {
Bukkit.savePlayers();
DiscordMessageSender.sendItalicizedRawMessageDiscord("All players have disconnected. Server is shutting down...");
for (int i=0;i<Bukkit.getWorlds().size();i++) {
Bukkit.getWorlds().get(i).save();
}
Bukkit.shutdown();
}
//Find the player that is getting removed.
PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId());
//Make sure to save the config for this player.