Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
SaveOnCommand.java
1 package org.bukkit.command.defaults;
2 
3 import java.util.List;
4 
5 import org.apache.commons.lang.Validate;
6 import org.bukkit.Bukkit;
7 import org.bukkit.World;
10 
11 import com.google.common.collect.ImmutableList;
12 
13 public class SaveOnCommand extends VanillaCommand {
14  public SaveOnCommand() {
15  super("save-on");
16  this.description = "Enables server autosaving";
17  this.usageMessage = "/save-on";
18  this.setPermission("bukkit.command.save.enable");
19  }
20 
21  @Override
22  public boolean execute(CommandSender sender, String currentAlias, String[] args) {
23  if (!testPermission(sender)) return true;
24 
25  for (World world : Bukkit.getWorlds()) {
26  world.setAutoSave(true);
27  }
28 
29  Command.broadcastCommandMessage(sender, "Enabled level saving..");
30  return true;
31  }
32 
33  @Override
34  public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
35  Validate.notNull(sender, "Sender cannot be null");
36  Validate.notNull(args, "Arguments cannot be null");
37  Validate.notNull(alias, "Alias cannot be null");
38 
39  return ImmutableList.of();
40  }
41 }
boolean testPermission(CommandSender target)
void setPermission(String permission)
static List< World > getWorlds()
Definition: Bukkit.java:229