001 package org.bukkit.command.defaults; 002 003 import java.util.List; 004 005 import org.apache.commons.lang.Validate; 006 import org.bukkit.Bukkit; 007 import org.bukkit.World; 008 import org.bukkit.command.Command; 009 import org.bukkit.command.CommandSender; 010 011 import com.google.common.collect.ImmutableList; 012 013 public class SaveOffCommand extends VanillaCommand { 014 public SaveOffCommand() { 015 super("save-off"); 016 this.description = "Disables server autosaving"; 017 this.usageMessage = "/save-off"; 018 this.setPermission("bukkit.command.save.disable"); 019 } 020 021 @Override 022 public boolean execute(CommandSender sender, String currentAlias, String[] args) { 023 if (!testPermission(sender)) return true; 024 025 for (World world : Bukkit.getWorlds()) { 026 world.setAutoSave(false); 027 } 028 029 Command.broadcastCommandMessage(sender, "Disabled level saving.."); 030 return true; 031 } 032 033 @Override 034 public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { 035 Validate.notNull(sender, "Sender cannot be null"); 036 Validate.notNull(args, "Arguments cannot be null"); 037 Validate.notNull(alias, "Alias cannot be null"); 038 039 return ImmutableList.of(); 040 } 041 }