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

dev
sigonasr2 9 years ago
parent 431eb48b22
commit f95737fa1e
  1. BIN
      TwosideKeeper.jar
  2. 2
      src/plugin.yml
  3. 2
      src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java
  4. 9
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java

Binary file not shown.

@ -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.

@ -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),

@ -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.

Loading…
Cancel
Save