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.command.CommandSender; 008 import org.bukkit.entity.Player; 009 010 import com.google.common.collect.ImmutableList; 011 012 public class SeedCommand extends VanillaCommand { 013 public SeedCommand() { 014 super("seed"); 015 this.description = "Shows the world seed"; 016 this.usageMessage = "/seed"; 017 this.setPermission("bukkit.command.seed"); 018 } 019 020 @Override 021 public boolean execute(CommandSender sender, String commandLabel, String[] args) { 022 if (!testPermission(sender)) return true; 023 long seed; 024 if (sender instanceof Player) { 025 seed = ((Player) sender).getWorld().getSeed(); 026 } else { 027 seed = Bukkit.getWorlds().get(0).getSeed(); 028 } 029 sender.sendMessage("Seed: " + seed); 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 }