    001    package net.minecraft.command;
    002
    003    import net.minecraft.server.MinecraftServer;
    004    import net.minecraft.util.StatCollector;
    005    import net.minecraft.world.EnumGameType;
    006
    007    public class CommandDefaultGameMode extends CommandGameMode
    008    {
    009        public String getCommandName()
    010        {
    011            return "defaultgamemode";
    012        }
    013
    014        public String getCommandUsage(ICommandSender par1ICommandSender)
    015        {
    016            return par1ICommandSender.translateString("commands.defaultgamemode.usage", new Object[0]);
    017        }
    018
    019        public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
    020        {
    021            if (par2ArrayOfStr.length > 0)
    022            {
    023                EnumGameType var3 = this.getGameModeFromCommand(par1ICommandSender, par2ArrayOfStr[0]);
    024                this.setGameType(var3);
    025                String var4 = StatCollector.translateToLocal("gameMode." + var3.getName());
    026                notifyAdmins(par1ICommandSender, "commands.defaultgamemode.success", new Object[] {var4});
    027            }
    028            else
    029            {
    030                throw new WrongUsageException("commands.defaultgamemode.usage", new Object[0]);
    031            }
    032        }
    033
    034        protected void setGameType(EnumGameType par1EnumGameType)
    035        {
    036            MinecraftServer.getServer().setGameType(par1EnumGameType);
    037        }
    038    }