当前位置: 首页>>代码示例>>Java>>正文


Java ICommandSender.setCommandStat方法代码示例

本文整理汇总了Java中net.minecraft.command.ICommandSender.setCommandStat方法的典型用法代码示例。如果您正苦于以下问题:Java ICommandSender.setCommandStat方法的具体用法?Java ICommandSender.setCommandStat怎么用?Java ICommandSender.setCommandStat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.command.ICommandSender的用法示例。


在下文中一共展示了ICommandSender.setCommandStat方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: emptyTeam

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
protected void emptyTeam(ICommandSender p_147188_1_, String[] p_147188_2_, int p_147188_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    ScorePlayerTeam scoreplayerteam = this.getTeam(p_147188_2_[p_147188_3_]);

    if (scoreplayerteam != null)
    {
        Collection<String> collection = Lists.newArrayList(scoreplayerteam.getMembershipCollection());
        p_147188_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, collection.size());

        if (collection.isEmpty())
        {
            throw new CommandException("commands.scoreboard.teams.empty.alreadyEmpty", new Object[] {scoreplayerteam.getRegisteredName()});
        }
        else
        {
            for (String s : collection)
            {
                scoreboard.removePlayerFromTeam(s, scoreplayerteam);
            }

            notifyOperators(p_147188_1_, this, "commands.scoreboard.teams.empty.success", new Object[] {Integer.valueOf(collection.size()), scoreplayerteam.getRegisteredName()});
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:CommandScoreboard.java

示例2: listPlayers

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
protected void listPlayers(ICommandSender p_147195_1_, String[] p_147195_2_, int p_147195_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();

    if (p_147195_2_.length > p_147195_3_)
    {
        String s = getEntityName(p_147195_1_, p_147195_2_[p_147195_3_]);
        Map<ScoreObjective, Score> map = scoreboard.getObjectivesForEntity(s);
        p_147195_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, map.size());

        if (map.size() <= 0)
        {
            throw new CommandException("commands.scoreboard.players.list.player.empty", new Object[] {s});
        }

        ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.scoreboard.players.list.player.count", new Object[] {Integer.valueOf(map.size()), s});
        chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
        p_147195_1_.addChatMessage(chatcomponenttranslation);

        for (Score score : map.values())
        {
            p_147195_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.players.list.player.entry", new Object[] {Integer.valueOf(score.getScorePoints()), score.getObjective().getDisplayName(), score.getObjective().getName()}));
        }
    }
    else
    {
        Collection<String> collection = scoreboard.getObjectiveNames();
        p_147195_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection.size());

        if (collection.size() <= 0)
        {
            throw new CommandException("commands.scoreboard.players.list.empty", new Object[0]);
        }

        ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.scoreboard.players.list.count", new Object[] {Integer.valueOf(collection.size())});
        chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
        p_147195_1_.addChatMessage(chatcomponenttranslation1);
        p_147195_1_.addChatMessage(new ChatComponentText(joinNiceString(collection.toArray())));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:41,代码来源:CommandScoreboard.java

示例3: processCommand

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    int i = MinecraftServer.getServer().getCurrentPlayerCount();
    sender.addChatMessage(new ChatComponentTranslation("commands.players.list", new Object[] {Integer.valueOf(i), Integer.valueOf(MinecraftServer.getServer().getMaxPlayers())}));
    sender.addChatMessage(new ChatComponentText(MinecraftServer.getServer().getConfigurationManager().func_181058_b(args.length > 0 && "uuids".equalsIgnoreCase(args[0]))));
    sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, i);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:CommandListPlayers.java

示例4: execute

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    int i = server.getCurrentPlayerCount();
    sender.addChatMessage(new TextComponentTranslation("commands.players.list", new Object[] {Integer.valueOf(i), Integer.valueOf(server.getMaxPlayers())}));
    sender.addChatMessage(new TextComponentString(server.getPlayerList().getFormattedListOfPlayers(args.length > 0 && "uuids".equalsIgnoreCase(args[0]))));
    sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, i);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:CommandListPlayers.java

示例5: listPlayers

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
protected void listPlayers(ICommandSender sender, String[] p_184920_2_, int p_184920_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);

    if (p_184920_2_.length > p_184920_3_)
    {
        String s = getEntityName(server, sender, p_184920_2_[p_184920_3_]);
        Map<ScoreObjective, Score> map = scoreboard.getObjectivesForEntity(s);
        sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, map.size());

        if (map.isEmpty())
        {
            throw new CommandException("commands.scoreboard.players.list.player.empty", new Object[] {s});
        }

        TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.scoreboard.players.list.player.count", new Object[] {Integer.valueOf(map.size()), s});
        textcomponenttranslation.getStyle().setColor(TextFormatting.DARK_GREEN);
        sender.addChatMessage(textcomponenttranslation);

        for (Score score : map.values())
        {
            sender.addChatMessage(new TextComponentTranslation("commands.scoreboard.players.list.player.entry", new Object[] {Integer.valueOf(score.getScorePoints()), score.getObjective().getDisplayName(), score.getObjective().getName()}));
        }
    }
    else
    {
        Collection<String> collection = scoreboard.getObjectiveNames();
        sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection.size());

        if (collection.isEmpty())
        {
            throw new CommandException("commands.scoreboard.players.list.empty", new Object[0]);
        }

        TextComponentTranslation textcomponenttranslation1 = new TextComponentTranslation("commands.scoreboard.players.list.count", new Object[] {Integer.valueOf(collection.size())});
        textcomponenttranslation1.getStyle().setColor(TextFormatting.DARK_GREEN);
        sender.addChatMessage(textcomponenttranslation1);
        sender.addChatMessage(new TextComponentString(joinNiceString(collection.toArray())));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:41,代码来源:CommandScoreboard.java

示例6: joinTeam

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
protected void joinTeam(ICommandSender p_147190_1_, String[] p_147190_2_, int p_147190_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = p_147190_2_[p_147190_3_++];
    Set<String> set = Sets.<String>newHashSet();
    Set<String> set1 = Sets.<String>newHashSet();

    if (p_147190_1_ instanceof EntityPlayer && p_147190_3_ == p_147190_2_.length)
    {
        String s4 = getCommandSenderAsPlayer(p_147190_1_).getName();

        if (scoreboard.addPlayerToTeam(s4, s))
        {
            set.add(s4);
        }
        else
        {
            set1.add(s4);
        }
    }
    else
    {
        while (p_147190_3_ < p_147190_2_.length)
        {
            String s1 = p_147190_2_[p_147190_3_++];

            if (s1.startsWith("@"))
            {
                for (Entity entity : func_175763_c(p_147190_1_, s1))
                {
                    String s3 = getEntityName(p_147190_1_, entity.getUniqueID().toString());

                    if (scoreboard.addPlayerToTeam(s3, s))
                    {
                        set.add(s3);
                    }
                    else
                    {
                        set1.add(s3);
                    }
                }
            }
            else
            {
                String s2 = getEntityName(p_147190_1_, s1);

                if (scoreboard.addPlayerToTeam(s2, s))
                {
                    set.add(s2);
                }
                else
                {
                    set1.add(s2);
                }
            }
        }
    }

    if (!set.isEmpty())
    {
        p_147190_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, set.size());
        notifyOperators(p_147190_1_, this, "commands.scoreboard.teams.join.success", new Object[] {Integer.valueOf(set.size()), s, joinNiceString(set.toArray(new String[set.size()]))});
    }

    if (!set1.isEmpty())
    {
        throw new CommandException("commands.scoreboard.teams.join.failure", new Object[] {Integer.valueOf(set1.size()), s, joinNiceString(set1.toArray(new String[set1.size()]))});
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:70,代码来源:CommandScoreboard.java

示例7: joinTeam

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
protected void joinTeam(ICommandSender sender, String[] p_184916_2_, int p_184916_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    String s = p_184916_2_[p_184916_3_++];
    Set<String> set = Sets.<String>newHashSet();
    Set<String> set1 = Sets.<String>newHashSet();

    if (sender instanceof EntityPlayer && p_184916_3_ == p_184916_2_.length)
    {
        String s4 = getCommandSenderAsPlayer(sender).getName();

        if (scoreboard.addPlayerToTeam(s4, s))
        {
            set.add(s4);
        }
        else
        {
            set1.add(s4);
        }
    }
    else
    {
        while (p_184916_3_ < p_184916_2_.length)
        {
            String s1 = p_184916_2_[p_184916_3_++];

            if (s1.startsWith("@"))
            {
                for (Entity entity : getEntityList(server, sender, s1))
                {
                    String s3 = getEntityName(server, sender, entity.getCachedUniqueIdString());

                    if (scoreboard.addPlayerToTeam(s3, s))
                    {
                        set.add(s3);
                    }
                    else
                    {
                        set1.add(s3);
                    }
                }
            }
            else
            {
                String s2 = getEntityName(server, sender, s1);

                if (scoreboard.addPlayerToTeam(s2, s))
                {
                    set.add(s2);
                }
                else
                {
                    set1.add(s2);
                }
            }
        }
    }

    if (!set.isEmpty())
    {
        sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, set.size());
        notifyCommandListener(sender, this, "commands.scoreboard.teams.join.success", new Object[] {Integer.valueOf(set.size()), s, joinNiceString(set.toArray(new String[set.size()]))});
    }

    if (!set1.isEmpty())
    {
        throw new CommandException("commands.scoreboard.teams.join.failure", new Object[] {Integer.valueOf(set1.size()), s, joinNiceString(set1.toArray(new String[set1.size()]))});
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:70,代码来源:CommandScoreboard.java

示例8: joinTeam

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
protected void joinTeam(ICommandSender sender, String[] p_184916_2_, int p_184916_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    String s = p_184916_2_[p_184916_3_++];
    Set<String> set = Sets.<String>newHashSet();
    Set<String> set1 = Sets.<String>newHashSet();

    if (sender instanceof EntityPlayer && p_184916_3_ == p_184916_2_.length)
    {
        String s4 = getCommandSenderAsPlayer(sender).getName();

        if (scoreboard.addPlayerToTeam(s4, s))
        {
            set.add(s4);
        }
        else
        {
            set1.add(s4);
        }
    }
    else
    {
        while (p_184916_3_ < p_184916_2_.length)
        {
            String s1 = p_184916_2_[p_184916_3_++];

            if (EntitySelector.hasArguments(s1))
            {
                for (Entity entity : getEntityList(server, sender, s1))
                {
                    String s3 = getEntityName(server, sender, entity.getCachedUniqueIdString());

                    if (scoreboard.addPlayerToTeam(s3, s))
                    {
                        set.add(s3);
                    }
                    else
                    {
                        set1.add(s3);
                    }
                }
            }
            else
            {
                String s2 = getEntityName(server, sender, s1);

                if (scoreboard.addPlayerToTeam(s2, s))
                {
                    set.add(s2);
                }
                else
                {
                    set1.add(s2);
                }
            }
        }
    }

    if (!set.isEmpty())
    {
        sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, set.size());
        notifyCommandListener(sender, this, "commands.scoreboard.teams.join.success", new Object[] {Integer.valueOf(set.size()), s, joinNiceString(set.toArray(new String[set.size()]))});
    }

    if (!set1.isEmpty())
    {
        throw new CommandException("commands.scoreboard.teams.join.failure", new Object[] {Integer.valueOf(set1.size()), s, joinNiceString(set1.toArray(new String[set1.size()]))});
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:70,代码来源:CommandScoreboard.java

示例9: leaveTeam

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
protected void leaveTeam(ICommandSender p_147199_1_, String[] p_147199_2_, int p_147199_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    Set<String> set = Sets.<String>newHashSet();
    Set<String> set1 = Sets.<String>newHashSet();

    if (p_147199_1_ instanceof EntityPlayer && p_147199_3_ == p_147199_2_.length)
    {
        String s3 = getCommandSenderAsPlayer(p_147199_1_).getName();

        if (scoreboard.removePlayerFromTeams(s3))
        {
            set.add(s3);
        }
        else
        {
            set1.add(s3);
        }
    }
    else
    {
        while (p_147199_3_ < p_147199_2_.length)
        {
            String s = p_147199_2_[p_147199_3_++];

            if (s.startsWith("@"))
            {
                for (Entity entity : func_175763_c(p_147199_1_, s))
                {
                    String s2 = getEntityName(p_147199_1_, entity.getUniqueID().toString());

                    if (scoreboard.removePlayerFromTeams(s2))
                    {
                        set.add(s2);
                    }
                    else
                    {
                        set1.add(s2);
                    }
                }
            }
            else
            {
                String s1 = getEntityName(p_147199_1_, s);

                if (scoreboard.removePlayerFromTeams(s1))
                {
                    set.add(s1);
                }
                else
                {
                    set1.add(s1);
                }
            }
        }
    }

    if (!set.isEmpty())
    {
        p_147199_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, set.size());
        notifyOperators(p_147199_1_, this, "commands.scoreboard.teams.leave.success", new Object[] {Integer.valueOf(set.size()), joinNiceString(set.toArray(new String[set.size()]))});
    }

    if (!set1.isEmpty())
    {
        throw new CommandException("commands.scoreboard.teams.leave.failure", new Object[] {Integer.valueOf(set1.size()), joinNiceString(set1.toArray(new String[set1.size()]))});
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:69,代码来源:CommandScoreboard.java

示例10: leaveTeam

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
protected void leaveTeam(ICommandSender sender, String[] p_184911_2_, int p_184911_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    Set<String> set = Sets.<String>newHashSet();
    Set<String> set1 = Sets.<String>newHashSet();

    if (sender instanceof EntityPlayer && p_184911_3_ == p_184911_2_.length)
    {
        String s3 = getCommandSenderAsPlayer(sender).getName();

        if (scoreboard.removePlayerFromTeams(s3))
        {
            set.add(s3);
        }
        else
        {
            set1.add(s3);
        }
    }
    else
    {
        while (p_184911_3_ < p_184911_2_.length)
        {
            String s = p_184911_2_[p_184911_3_++];

            if (s.startsWith("@"))
            {
                for (Entity entity : getEntityList(server, sender, s))
                {
                    String s2 = getEntityName(server, sender, entity.getCachedUniqueIdString());

                    if (scoreboard.removePlayerFromTeams(s2))
                    {
                        set.add(s2);
                    }
                    else
                    {
                        set1.add(s2);
                    }
                }
            }
            else
            {
                String s1 = getEntityName(server, sender, s);

                if (scoreboard.removePlayerFromTeams(s1))
                {
                    set.add(s1);
                }
                else
                {
                    set1.add(s1);
                }
            }
        }
    }

    if (!set.isEmpty())
    {
        sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, set.size());
        notifyCommandListener(sender, this, "commands.scoreboard.teams.leave.success", new Object[] {Integer.valueOf(set.size()), joinNiceString(set.toArray(new String[set.size()]))});
    }

    if (!set1.isEmpty())
    {
        throw new CommandException("commands.scoreboard.teams.leave.failure", new Object[] {Integer.valueOf(set1.size()), joinNiceString(set1.toArray(new String[set1.size()]))});
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:69,代码来源:CommandScoreboard.java

示例11: func_175780_b

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
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;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:58,代码来源:CommandScoreboard.java

示例12: listTeams

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
protected void listTeams(ICommandSender p_147186_1_, String[] p_147186_2_, int p_147186_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();

    if (p_147186_2_.length > p_147186_3_)
    {
        ScorePlayerTeam scoreplayerteam = this.getTeam(p_147186_2_[p_147186_3_]);

        if (scoreplayerteam == null)
        {
            return;
        }

        Collection<String> collection = scoreplayerteam.getMembershipCollection();
        p_147186_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection.size());

        if (collection.size() <= 0)
        {
            throw new CommandException("commands.scoreboard.teams.list.player.empty", new Object[] {scoreplayerteam.getRegisteredName()});
        }

        ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.scoreboard.teams.list.player.count", new Object[] {Integer.valueOf(collection.size()), scoreplayerteam.getRegisteredName()});
        chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
        p_147186_1_.addChatMessage(chatcomponenttranslation);
        p_147186_1_.addChatMessage(new ChatComponentText(joinNiceString(collection.toArray())));
    }
    else
    {
        Collection<ScorePlayerTeam> collection1 = scoreboard.getTeams();
        p_147186_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection1.size());

        if (collection1.size() <= 0)
        {
            throw new CommandException("commands.scoreboard.teams.list.empty", new Object[0]);
        }

        ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.scoreboard.teams.list.count", new Object[] {Integer.valueOf(collection1.size())});
        chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
        p_147186_1_.addChatMessage(chatcomponenttranslation1);

        for (ScorePlayerTeam scoreplayerteam1 : collection1)
        {
            p_147186_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.teams.list.entry", new Object[] {scoreplayerteam1.getRegisteredName(), scoreplayerteam1.getTeamName(), Integer.valueOf(scoreplayerteam1.getMembershipCollection().size())}));
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:47,代码来源:CommandScoreboard.java

示例13: applyPlayerTag

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
protected void applyPlayerTag(MinecraftServer server, ICommandSender sender, String[] p_184924_3_, int p_184924_4_) throws CommandException
{
    String s = getEntityName(server, sender, p_184924_3_[p_184924_4_]);
    Entity entity = getEntity(server, sender, p_184924_3_[p_184924_4_++]);
    String s1 = p_184924_3_[p_184924_4_++];
    Set<String> set = entity.getTags();

    if ("list".equals(s1))
    {
        if (!set.isEmpty())
        {
            TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.scoreboard.players.tag.list", new Object[] {s});
            textcomponenttranslation.getStyle().setColor(TextFormatting.DARK_GREEN);
            sender.addChatMessage(textcomponenttranslation);
            sender.addChatMessage(new TextComponentString(joinNiceString(set.toArray())));
        }

        sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, set.size());
    }
    else if (p_184924_3_.length < 5)
    {
        throw new WrongUsageException("commands.scoreboard.players.tag.usage", new Object[0]);
    }
    else
    {
        String s2 = p_184924_3_[p_184924_4_++];

        if (p_184924_3_.length > p_184924_4_)
        {
            try
            {
                NBTTagCompound nbttagcompound = JsonToNBT.getTagFromJson(buildString(p_184924_3_, p_184924_4_));
                NBTTagCompound nbttagcompound1 = entityToNBT(entity);

                if (!NBTUtil.areNBTEquals(nbttagcompound, nbttagcompound1, true))
                {
                    throw new CommandException("commands.scoreboard.players.tag.tagMismatch", new Object[] {s});
                }
            }
            catch (NBTException nbtexception)
            {
                throw new CommandException("commands.scoreboard.players.tag.tagError", new Object[] {nbtexception.getMessage()});
            }
        }

        if ("add".equals(s1))
        {
            if (!entity.addTag(s2))
            {
                throw new CommandException("commands.scoreboard.players.tag.tooMany", new Object[] {Integer.valueOf(1024)});
            }

            notifyCommandListener(sender, this, "commands.scoreboard.players.tag.success.add", new Object[] {s2});
        }
        else
        {
            if (!"remove".equals(s1))
            {
                throw new WrongUsageException("commands.scoreboard.players.tag.usage", new Object[0]);
            }

            if (!entity.removeTag(s2))
            {
                throw new CommandException("commands.scoreboard.players.tag.notFound", new Object[] {s2});
            }

            notifyCommandListener(sender, this, "commands.scoreboard.players.tag.success.remove", new Object[] {s2});
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:71,代码来源:CommandScoreboard.java

示例14: handleUserWildcards

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
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;
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:58,代码来源:CommandScoreboard.java


注:本文中的net.minecraft.command.ICommandSender.setCommandStat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。