All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minecraft.server.CommandSaveOff Maven / Gradle / Ivy

package net.minecraft.server;

public class CommandSaveOff extends CommandAbstract {
	
	public CommandSaveOff() {
	}
	
	public String getCommand() {
		return "save-off";
	}
	
	public String getUsage(ICommandListener icommandlistener) {
		return "commands.save-off.usage";
	}
	
	public void execute(ICommandListener icommandlistener, String[] astring) throws CommandException {
		MinecraftServer minecraftserver = MinecraftServer.getServer();
		boolean flag = false;
		
		for (int i = 0; i < minecraftserver.worldServer.length; ++i) {
			if (minecraftserver.worldServer[i] != null) {
				WorldServer worldserver = minecraftserver.worldServer[i];
				
				if (!worldserver.savingDisabled) {
					worldserver.savingDisabled = true;
					flag = true;
				}
			}
		}
		
		if (flag) {
			a(icommandlistener, this, "commands.save.disabled");
		} else {
			throw new CommandException("commands.save-off.alreadyOff");
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy