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


Java ScoreObjective类代码示例

本文整理汇总了Java中net.minecraft.scoreboard.ScoreObjective的典型用法代码示例。如果您正苦于以下问题:Java ScoreObjective类的具体用法?Java ScoreObjective怎么用?Java ScoreObjective使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: resetPlayers

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
protected void resetPlayers(ICommandSender p_147187_1_, String[] p_147187_2_, int p_147187_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = getEntityName(p_147187_1_, p_147187_2_[p_147187_3_++]);

    if (p_147187_2_.length > p_147187_3_)
    {
        ScoreObjective scoreobjective = this.getObjective(p_147187_2_[p_147187_3_++], false);
        scoreboard.removeObjectiveFromEntity(s, scoreobjective);
        notifyOperators(p_147187_1_, this, "commands.scoreboard.players.resetscore.success", new Object[] {scoreobjective.getName(), s});
    }
    else
    {
        scoreboard.removeObjectiveFromEntity(s, (ScoreObjective)null);
        notifyOperators(p_147187_1_, this, "commands.scoreboard.players.reset.success", new Object[] {s});
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:CommandScoreboard.java

示例2: func_175145_a

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
public void func_175145_a(StatBase p_175145_1_)
{
    if (p_175145_1_ != null)
    {
        this.statsFile.unlockAchievement(this, p_175145_1_, 0);

        for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(p_175145_1_.func_150952_k()))
        {
            this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective).setScorePoints(0);
        }

        if (this.statsFile.func_150879_e())
        {
            this.statsFile.func_150876_a(this);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:EntityPlayerMP.java

示例3: convertToObjective

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
protected ScoreObjective convertToObjective(String name, boolean forWrite, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    ScoreObjective scoreobjective = scoreboard.getObjective(name);

    if (scoreobjective == null)
    {
        throw new CommandException("commands.scoreboard.objectiveNotFound", new Object[] {name});
    }
    else if (forWrite && scoreobjective.getCriteria().isReadOnly())
    {
        throw new CommandException("commands.scoreboard.objectiveReadOnly", new Object[] {name});
    }
    else
    {
        return scoreobjective;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:CommandScoreboard.java

示例4: sendScoreboard

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
protected void sendScoreboard(ServerScoreboard scoreboardIn, EntityPlayerMP playerIn)
{
    Set<ScoreObjective> set = Sets.<ScoreObjective>newHashSet();

    for (ScorePlayerTeam scoreplayerteam : scoreboardIn.getTeams())
    {
        playerIn.playerNetServerHandler.sendPacket(new S3EPacketTeams(scoreplayerteam, 0));
    }

    for (int i = 0; i < 19; ++i)
    {
        ScoreObjective scoreobjective = scoreboardIn.getObjectiveInDisplaySlot(i);

        if (scoreobjective != null && !set.contains(scoreobjective))
        {
            for (Packet packet : scoreboardIn.func_96550_d(scoreobjective))
            {
                playerIn.playerNetServerHandler.sendPacket(packet);
            }

            set.add(scoreobjective);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:25,代码来源:ServerConfigurationManager.java

示例5: resolve

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
public void resolve(ICommandSender sender)
{
    MinecraftServer minecraftserver = sender.getServer();

    if (minecraftserver != null && minecraftserver.isAnvilFileSet() && StringUtils.isNullOrEmpty(this.value))
    {
        Scoreboard scoreboard = minecraftserver.worldServerForDimension(0).getScoreboard();
        ScoreObjective scoreobjective = scoreboard.getObjective(this.objective);

        if (scoreboard.entityHasObjective(this.name, scoreobjective))
        {
            Score score = scoreboard.getOrCreateScore(this.name, scoreobjective);
            this.setValue(String.format("%d", new Object[] {Integer.valueOf(score.getScorePoints())}));
            return;
        }
    }

    this.value = "";
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:TextComponentScore.java

示例6: getUnformattedTextForChat

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
/**
 * Gets the text of this component, without any special formatting codes added, for chat.  TODO: why is this two
 * different methods?
 */
public String getUnformattedTextForChat()
{
    MinecraftServer minecraftserver = MinecraftServer.getServer();

    if (minecraftserver != null && minecraftserver.isAnvilFileSet() && StringUtils.isNullOrEmpty(this.value))
    {
        Scoreboard scoreboard = minecraftserver.worldServerForDimension(0).getScoreboard();
        ScoreObjective scoreobjective = scoreboard.getObjective(this.objective);

        if (scoreboard.entityHasObjective(this.name, scoreobjective))
        {
            Score score = scoreboard.getValueFromObjective(this.name, scoreobjective);
            this.setValue(String.format("%d", new Object[] {Integer.valueOf(score.getScorePoints())}));
        }
        else
        {
            this.value = "";
        }
    }

    return this.value;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:ChatComponentScore.java

示例7: getObjective

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
protected ScoreObjective getObjective(String name, boolean edit) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    ScoreObjective scoreobjective = scoreboard.getObjective(name);

    if (scoreobjective == null)
    {
        throw new CommandException("commands.scoreboard.objectiveNotFound", new Object[] {name});
    }
    else if (edit && scoreobjective.getCriteria().isReadOnly())
    {
        throw new CommandException("commands.scoreboard.objectiveReadOnly", new Object[] {name});
    }
    else
    {
        return scoreobjective;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:CommandScoreboard.java

示例8: listObjectives

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
protected void listObjectives(ICommandSender p_147196_1_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    Collection<ScoreObjective> collection = scoreboard.getScoreObjectives();

    if (collection.size() <= 0)
    {
        throw new CommandException("commands.scoreboard.objectives.list.empty", new Object[0]);
    }
    else
    {
        ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.scoreboard.objectives.list.count", new Object[] {Integer.valueOf(collection.size())});
        chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN);
        p_147196_1_.addChatMessage(chatcomponenttranslation);

        for (ScoreObjective scoreobjective : collection)
        {
            p_147196_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.objectives.list.entry", new Object[] {scoreobjective.getName(), scoreobjective.getDisplayName(), scoreobjective.getCriteria().getName()}));
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:CommandScoreboard.java

示例9: sendScoreboard

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
protected void sendScoreboard(ServerScoreboard scoreboardIn, EntityPlayerMP playerIn)
{
    Set<ScoreObjective> set = Sets.<ScoreObjective>newHashSet();

    for (ScorePlayerTeam scoreplayerteam : scoreboardIn.getTeams())
    {
        playerIn.connection.sendPacket(new SPacketTeams(scoreplayerteam, 0));
    }

    for (int i = 0; i < 19; ++i)
    {
        ScoreObjective scoreobjective = scoreboardIn.getObjectiveInDisplaySlot(i);

        if (scoreobjective != null && !set.contains(scoreobjective))
        {
            for (Packet<?> packet : scoreboardIn.getCreatePackets(scoreobjective))
            {
                playerIn.connection.sendPacket(packet);
            }

            set.add(scoreobjective);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:PlayerList.java

示例10: listObjectives

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
protected void listObjectives(ICommandSender sender, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    Collection<ScoreObjective> collection = scoreboard.getScoreObjectives();

    if (collection.isEmpty())
    {
        throw new CommandException("commands.scoreboard.objectives.list.empty", new Object[0]);
    }
    else
    {
        TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.scoreboard.objectives.list.count", new Object[] {Integer.valueOf(collection.size())});
        textcomponenttranslation.getStyle().setColor(TextFormatting.DARK_GREEN);
        sender.addChatMessage(textcomponenttranslation);

        for (ScoreObjective scoreobjective : collection)
        {
            sender.addChatMessage(new TextComponentTranslation("commands.scoreboard.objectives.list.entry", new Object[] {scoreobjective.getName(), scoreobjective.getDisplayName(), scoreobjective.getCriteria().getName()}));
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:CommandScoreboard.java

示例11: enablePlayerTrigger

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
protected void enablePlayerTrigger(ICommandSender sender, String[] p_184914_2_, int p_184914_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    String s = getPlayerName(server, sender, p_184914_2_[p_184914_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.convertToObjective(p_184914_2_[p_184914_3_], false, server);

        if (scoreobjective.getCriteria() != IScoreCriteria.TRIGGER)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
        }
        else
        {
            Score score = scoreboard.getOrCreateScore(s, scoreobjective);
            score.setLocked(false);
            notifyCommandListener(sender, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:CommandScoreboard.java

示例12: addTabCompletionOptions

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
{
    if (args.length == 1)
    {
        Scoreboard scoreboard = MinecraftServer.getServer().worldServerForDimension(0).getScoreboard();
        List<String> list = Lists.<String>newArrayList();

        for (ScoreObjective scoreobjective : scoreboard.getScoreObjectives())
        {
            if (scoreobjective.getCriteria() == IScoreObjectiveCriteria.TRIGGER)
            {
                list.add(scoreobjective.getName());
            }
        }

        return getListOfStringsMatchingLastWord(args, (String[])list.toArray(new String[list.size()]));
    }
    else
    {
        return args.length == 2 ? getListOfStringsMatchingLastWord(args, new String[] {"add", "set"}): null;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:CommandTrigger.java

示例13: addStat

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
/**
 * Adds a value to a statistic field.
 */
public void addStat(StatBase stat, int amount)
{
    if (stat != null)
    {
        this.statsFile.increaseStat(this, stat, amount);

        for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.func_150952_k()))
        {
            this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective).increseScore(amount);
        }

        if (this.statsFile.func_150879_e())
        {
            this.statsFile.func_150876_a(this);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:21,代码来源:EntityPlayerMP.java

示例14: addToPlayerScore

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
/**
 * Adds a value to the player score. Currently not actually used and the entity passed in does nothing. Args:
 * entity, scoreToAdd
 */
public void addToPlayerScore(Entity entityIn, int amount)
{
    this.addScore(amount);
    Collection<ScoreObjective> collection = this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.totalKillCount);

    if (entityIn instanceof EntityPlayer)
    {
        this.triggerAchievement(StatList.playerKillsStat);
        collection.addAll(this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.playerKillCount));
        collection.addAll(this.func_175137_e(entityIn));
    }
    else
    {
        this.triggerAchievement(StatList.mobKillsStat);
    }

    for (ScoreObjective scoreobjective : collection)
    {
        Score score = this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective);
        score.func_96648_a();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:EntityPlayer.java

示例15: resetPlayerScore

import net.minecraft.scoreboard.ScoreObjective; //导入依赖的package包/类
protected void resetPlayerScore(ICommandSender sender, String[] p_184912_2_, int p_184912_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    String s = getEntityName(server, sender, p_184912_2_[p_184912_3_++]);

    if (p_184912_2_.length > p_184912_3_)
    {
        ScoreObjective scoreobjective = this.convertToObjective(p_184912_2_[p_184912_3_++], false, server);
        scoreboard.removeObjectiveFromEntity(s, scoreobjective);
        notifyCommandListener(sender, this, "commands.scoreboard.players.resetscore.success", new Object[] {scoreobjective.getName(), s});
    }
    else
    {
        scoreboard.removeObjectiveFromEntity(s, (ScoreObjective)null);
        notifyCommandListener(sender, this, "commands.scoreboard.players.reset.success", new Object[] {s});
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:CommandScoreboard.java


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