Java Code Examples for net.minecraft.command.CommandException.getMessage()

The following are Jave code examples for showing how to use getMessage() of the net.minecraft.command.CommandException class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: DecompiledMinecraft   File: CommandScoreboard.java   Source Code and License Vote up 4 votes
private boolean func_175780_b(ICommandSender p_175780_1_, String[] p_175780_2_) throws CommandException
{
    int i = -1;

    for (int j = 0; j < p_175780_2_.length; ++j)
    {
        if (this.isUsernameIndex(p_175780_2_, j) && "*".equals(p_175780_2_[j]))
        {
            if (i >= 0)
            {
                throw new CommandException("commands.scoreboard.noMultiWildcard", new Object[0]);
            }

            i = j;
        }
    }

    if (i < 0)
    {
        return false;
    }
    else
    {
        List<String> list1 = Lists.newArrayList(this.getScoreboard().getObjectiveNames());
        String s = p_175780_2_[i];
        List<String> list = Lists.<String>newArrayList();

        for (String s1 : list1)
        {
            p_175780_2_[i] = s1;

            try
            {
                this.processCommand(p_175780_1_, p_175780_2_);
                list.add(s1);
            }
            catch (CommandException commandexception)
            {
                ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects());
                chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
                p_175780_1_.addChatMessage(chatcomponenttranslation);
            }
        }

        p_175780_2_[i] = s;
        p_175780_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, list.size());

        if (list.size() == 0)
        {
            throw new WrongUsageException("commands.scoreboard.allMatchesFailed", new Object[0]);
        }
        else
        {
            return true;
        }
    }
}
 
Example 2
Project: DecompiledMinecraft   File: CommandScoreboard.java   Source Code and License Vote up 4 votes
private boolean func_175780_b(ICommandSender p_175780_1_, String[] p_175780_2_) throws CommandException
{
    int i = -1;

    for (int j = 0; j < p_175780_2_.length; ++j)
    {
        if (this.isUsernameIndex(p_175780_2_, j) && "*".equals(p_175780_2_[j]))
        {
            if (i >= 0)
            {
                throw new CommandException("commands.scoreboard.noMultiWildcard", new Object[0]);
            }

            i = j;
        }
    }

    if (i < 0)
    {
        return false;
    }
    else
    {
        List<String> list1 = Lists.newArrayList(this.getScoreboard().getObjectiveNames());
        String s = p_175780_2_[i];
        List<String> list = Lists.<String>newArrayList();

        for (String s1 : list1)
        {
            p_175780_2_[i] = s1;

            try
            {
                this.processCommand(p_175780_1_, p_175780_2_);
                list.add(s1);
            }
            catch (CommandException commandexception)
            {
                ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects());
                chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
                p_175780_1_.addChatMessage(chatcomponenttranslation);
            }
        }

        p_175780_2_[i] = s;
        p_175780_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, list.size());

        if (list.size() == 0)
        {
            throw new WrongUsageException("commands.scoreboard.allMatchesFailed", new Object[0]);
        }
        else
        {
            return true;
        }
    }
}
 
Example 3
Project: BaseClient   File: CommandScoreboard.java   Source Code and License Vote up 4 votes
private boolean func_175780_b(ICommandSender p_175780_1_, String[] p_175780_2_) throws CommandException
{
    int i = -1;

    for (int j = 0; j < p_175780_2_.length; ++j)
    {
        if (this.isUsernameIndex(p_175780_2_, j) && "*".equals(p_175780_2_[j]))
        {
            if (i >= 0)
            {
                throw new CommandException("commands.scoreboard.noMultiWildcard", new Object[0]);
            }

            i = j;
        }
    }

    if (i < 0)
    {
        return false;
    }
    else
    {
        List<String> list1 = Lists.newArrayList(this.getScoreboard().getObjectiveNames());
        String s = p_175780_2_[i];
        List<String> list = Lists.<String>newArrayList();

        for (String s1 : list1)
        {
            p_175780_2_[i] = s1;

            try
            {
                this.processCommand(p_175780_1_, p_175780_2_);
                list.add(s1);
            }
            catch (CommandException commandexception)
            {
                ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects());
                chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
                p_175780_1_.addChatMessage(chatcomponenttranslation);
            }
        }

        p_175780_2_[i] = s;
        p_175780_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, list.size());

        if (list.size() == 0)
        {
            throw new WrongUsageException("commands.scoreboard.allMatchesFailed", new Object[0]);
        }
        else
        {
            return true;
        }
    }
}
 
Example 4
Project: BaseClient   File: CommandScoreboard.java   Source Code and License Vote up 4 votes
private boolean func_175780_b(ICommandSender p_175780_1_, String[] p_175780_2_) throws CommandException
{
    int i = -1;

    for (int j = 0; j < p_175780_2_.length; ++j)
    {
        if (this.isUsernameIndex(p_175780_2_, j) && "*".equals(p_175780_2_[j]))
        {
            if (i >= 0)
            {
                throw new CommandException("commands.scoreboard.noMultiWildcard", new Object[0]);
            }

            i = j;
        }
    }

    if (i < 0)
    {
        return false;
    }
    else
    {
        List<String> list1 = Lists.newArrayList(this.getScoreboard().getObjectiveNames());
        String s = p_175780_2_[i];
        List<String> list = Lists.<String>newArrayList();

        for (String s1 : list1)
        {
            p_175780_2_[i] = s1;

            try
            {
                this.processCommand(p_175780_1_, p_175780_2_);
                list.add(s1);
            }
            catch (CommandException commandexception)
            {
                ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects());
                chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
                p_175780_1_.addChatMessage(chatcomponenttranslation);
            }
        }

        p_175780_2_[i] = s;
        p_175780_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, list.size());

        if (list.size() == 0)
        {
            throw new WrongUsageException("commands.scoreboard.allMatchesFailed", new Object[0]);
        }
        else
        {
            return true;
        }
    }
}
 
Example 5
Project: Backmemed   File: CommandScoreboard.java   Source Code and License Vote up 4 votes
private boolean handleUserWildcards(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    int i = -1;

    for (int j = 0; j < args.length; ++j)
    {
        if (this.isUsernameIndex(args, j) && "*".equals(args[j]))
        {
            if (i >= 0)
            {
                throw new CommandException("commands.scoreboard.noMultiWildcard", new Object[0]);
            }

            i = j;
        }
    }

    if (i < 0)
    {
        return false;
    }
    else
    {
        List<String> list1 = Lists.newArrayList(this.getScoreboard(server).getObjectiveNames());
        String s = args[i];
        List<String> list = Lists.<String>newArrayList();

        for (String s1 : list1)
        {
            args[i] = s1;

            try
            {
                this.execute(server, sender, args);
                list.add(s1);
            }
            catch (CommandException commandexception)
            {
                TextComponentTranslation textcomponenttranslation = new TextComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects());
                textcomponenttranslation.getStyle().setColor(TextFormatting.RED);
                sender.addChatMessage(textcomponenttranslation);
            }
        }

        args[i] = s;
        sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, list.size());

        if (list.isEmpty())
        {
            throw new WrongUsageException("commands.scoreboard.allMatchesFailed", new Object[0]);
        }
        else
        {
            return true;
        }
    }
}
 
Example 6
Project: CustomWorldGen   File: CommandScoreboard.java   Source Code and License Vote up 4 votes
private boolean handleUserWildcards(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    int i = -1;

    for (int j = 0; j < args.length; ++j)
    {
        if (this.isUsernameIndex(args, j) && "*".equals(args[j]))
        {
            if (i >= 0)
            {
                throw new CommandException("commands.scoreboard.noMultiWildcard", new Object[0]);
            }

            i = j;
        }
    }

    if (i < 0)
    {
        return false;
    }
    else
    {
        List<String> list1 = Lists.newArrayList(this.getScoreboard(server).getObjectiveNames());
        String s = args[i];
        List<String> list = Lists.<String>newArrayList();

        for (String s1 : list1)
        {
            args[i] = s1;

            try
            {
                this.execute(server, sender, args);
                list.add(s1);
            }
            catch (CommandException commandexception)
            {
                TextComponentTranslation textcomponenttranslation = new TextComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects());
                textcomponenttranslation.getStyle().setColor(TextFormatting.RED);
                sender.addChatMessage(textcomponenttranslation);
            }
        }

        args[i] = s;
        sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, list.size());

        if (list.isEmpty())
        {
            throw new WrongUsageException("commands.scoreboard.allMatchesFailed", new Object[0]);
        }
        else
        {
            return true;
        }
    }
}