    001package net.minecraft.command;
    002
    003import net.minecraft.entity.player.EntityPlayer;
    004import net.minecraft.server.MinecraftServer;
    005import net.minecraft.world.World;
    006
    007public class CommandShowSeed extends CommandBase
    008{
    009    /**
    010     * Returns true if the given command sender is allowed to use this command.
    011     */
    012    public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender)
    013    {
    014        return MinecraftServer.getServer().isSinglePlayer() || super.canCommandSenderUseCommand(par1ICommandSender);
    015    }
    016
    017    public String getCommandName()
    018    {
    019        return "seed";
    020    }
    021
    022    /**
    023     * Return the required permission level for this command.
    024     */
    025    public int getRequiredPermissionLevel()
    026    {
    027        return 2;
    028    }
    029
    030    public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    031    {
    032        Object object = par1ICommandSender instanceof EntityPlayer ? ((EntityPlayer)par1ICommandSender).worldObj : MinecraftServer.getServer().worldServerForDimension(0);
    033        par1ICommandSender.sendChatToPlayer("Seed: " + ((World)object).getSeed());
    034    }
    035}