    001    package net.minecraft.src;
    002
    003    import net.minecraft.server.MinecraftServer;
    004
    005    public class CommandServerSaveAll extends CommandBase
    006    {
    007        public String getCommandName()
    008        {
    009            return "save-all";
    010        }
    011
    012        /**
    013         * Return the required permission level for this command.
    014         */
    015        public int getRequiredPermissionLevel()
    016        {
    017            return 4;
    018        }
    019
    020        public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    021        {
    022            MinecraftServer var3 = MinecraftServer.getServer();
    023            par1ICommandSender.sendChatToPlayer(par1ICommandSender.translateString("commands.save.start", new Object[0]));
    024
    025            if (var3.getConfigurationManager() != null)
    026            {
    027                var3.getConfigurationManager().saveAllPlayerData();
    028            }
    029
    030            try
    031            {
    032                for (int var4 = 0; var4 < var3.worldServers.length; ++var4)
    033                {
    034                    if (var3.worldServers[var4] != null)
    035                    {
    036                        WorldServer var5 = var3.worldServers[var4];
    037                        boolean var6 = var5.canNotSave;
    038                        var5.canNotSave = false;
    039                        var5.saveAllChunks(true, (IProgressUpdate)null);
    040                        var5.canNotSave = var6;
    041                    }
    042                }
    043            }
    044            catch (MinecraftException var7)
    045            {
    046                notifyAdmins(par1ICommandSender, "commands.save.failed", new Object[] {var7.getMessage()});
    047                return;
    048            }
    049
    050            notifyAdmins(par1ICommandSender, "commands.save.success", new Object[0]);
    051        }
    052    }