    001    package net.minecraft.src;
    002
    003    import java.util.List;
    004    import java.util.Random;
    005    import net.minecraft.server.MinecraftServer;
    006
    007    public class CommandWeather extends CommandBase
    008    {
    009        public String getCommandName()
    010        {
    011            return "weather";
    012        }
    013
    014        public int func_82362_a()
    015        {
    016            return 2;
    017        }
    018
    019        public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    020        {
    021            if (par2ArrayOfStr.length < 1)
    022            {
    023                throw new WrongUsageException("commands.weather.usage", new Object[0]);
    024            }
    025            else
    026            {
    027                int var3 = (300 + (new Random()).nextInt(600)) * 20;
    028
    029                if (par2ArrayOfStr.length >= 2)
    030                {
    031                    var3 = parseIntBounded(par1ICommandSender, par2ArrayOfStr[1], 1, 1000000) * 20;
    032                }
    033
    034                WorldServer var4 = MinecraftServer.getServer().worldServers[0];
    035                WorldInfo var5 = var4.getWorldInfo();
    036                var5.setRainTime(var3);
    037                var5.setThunderTime(var3);
    038
    039                if ("clear".equalsIgnoreCase(par2ArrayOfStr[0]))
    040                {
    041                    var5.setRaining(false);
    042                    var5.setThundering(false);
    043                    notifyAdmins(par1ICommandSender, "commands.weather.clear", new Object[0]);
    044                }
    045                else if ("rain".equalsIgnoreCase(par2ArrayOfStr[0]))
    046                {
    047                    var5.setRaining(true);
    048                    var5.setThundering(false);
    049                    notifyAdmins(par1ICommandSender, "commands.weather.rain", new Object[0]);
    050                }
    051                else if ("thunder".equalsIgnoreCase(par2ArrayOfStr[0]))
    052                {
    053                    var5.setRaining(true);
    054                    var5.setThundering(true);
    055                    notifyAdmins(par1ICommandSender, "commands.weather.thunder", new Object[0]);
    056                }
    057            }
    058        }
    059
    060        /**
    061         * Adds the strings available in this command to the given list of tab completion options.
    062         */
    063        public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    064        {
    065            return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, new String[] {"clear", "rain", "thunder"}): null;
    066        }
    067    }