
net.minecraft.server.CommandSaveAll Maven / Gradle / Ivy
package net.minecraft.server;
public class CommandSaveAll extends CommandAbstract {
public CommandSaveAll() {
}
public String getCommand() {
return "save-all";
}
public String getUsage(ICommandListener icommandlistener) {
return "commands.save.usage";
}
public void execute(ICommandListener icommandlistener, String[] astring) throws CommandException {
MinecraftServer minecraftserver = MinecraftServer.getServer();
icommandlistener.sendMessage(new ChatMessage("commands.save.start"));
if (minecraftserver.getPlayerList() != null) {
minecraftserver.getPlayerList().savePlayers();
}
try {
int i;
WorldServer worldserver;
boolean flag;
for (i = 0; i < minecraftserver.worldServer.length; ++i) {
if (minecraftserver.worldServer[i] != null) {
worldserver = minecraftserver.worldServer[i];
flag = worldserver.savingDisabled;
worldserver.savingDisabled = false;
worldserver.save(true, null);
worldserver.savingDisabled = flag;
}
}
if (astring.length > 0 && "flush".equals(astring[0])) {
icommandlistener.sendMessage(new ChatMessage("commands.save.flushStart"));
for (i = 0; i < minecraftserver.worldServer.length; ++i) {
if (minecraftserver.worldServer[i] != null) {
worldserver = minecraftserver.worldServer[i];
flag = worldserver.savingDisabled;
worldserver.savingDisabled = false;
worldserver.flushSave();
worldserver.savingDisabled = flag;
}
}
icommandlistener.sendMessage(new ChatMessage("commands.save.flushEnd"));
}
} catch (ExceptionWorldConflict exceptionworldconflict) {
a(icommandlistener, this, "commands.save.failed", exceptionworldconflict.getMessage());
return;
}
a(icommandlistener, this, "commands.save.success");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy