Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
SeedCommand.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;
8 import org.bukkit.entity.Player;
9 
10 import com.google.common.collect.ImmutableList;
11 
12 public class SeedCommand extends VanillaCommand {
13  public SeedCommand() {
14  super("seed");
15  this.description = "Shows the world seed";
16  this.usageMessage = "/seed";
17  this.setPermission("bukkit.command.seed");
18  }
19 
20  @Override
21  public boolean execute(CommandSender sender, String commandLabel, String[] args) {
22  if (!testPermission(sender)) return true;
23  long seed;
24  if (sender instanceof Player) {
25  seed = ((Player) sender).getWorld().getSeed();
26  } else {
27  seed = Bukkit.getWorlds().get(0).getSeed();
28  }
29  sender.sendMessage("Seed: " + seed);
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 sendMessage(String message)
void setPermission(String permission)
static List< World > getWorlds()
Definition: Bukkit.java:229