本文整理汇总了Java中net.minecraft.scoreboard.Scoreboard.getScoreObjectives方法的典型用法代码示例。如果您正苦于以下问题:Java Scoreboard.getScoreObjectives方法的具体用法?Java Scoreboard.getScoreObjectives怎么用?Java Scoreboard.getScoreObjectives使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.scoreboard.Scoreboard
的用法示例。
在下文中一共展示了Scoreboard.getScoreObjectives方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listObjectives
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的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()}));
}
}
}
示例2: addTabCompletionOptions
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的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;
}
}
示例3: listObjectives
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的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()}));
}
}
}
示例4: getTabCompletionOptions
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
{
if (args.length == 1)
{
Scoreboard scoreboard = server.worldServerForDimension(0).getScoreboard();
List<String> list = Lists.<String>newArrayList();
for (ScoreObjective scoreobjective : scoreboard.getScoreObjectives())
{
if (scoreobjective.getCriteria() == IScoreCriteria.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"}): Collections.<String>emptyList();
}
}
示例5: getTabCompletionOptions
import net.minecraft.scoreboard.Scoreboard; //导入方法依赖的package包/类
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
{
if (args.length == 1)
{
Scoreboard scoreboard = server.worldServerForDimension(0).getScoreboard();
List<String> list = Lists.<String>newArrayList();
for (ScoreObjective scoreobjective : scoreboard.getScoreObjectives())
{
if (scoreobjective.getCriteria() == IScoreCriteria.TRIGGER)
{
list.add(scoreobjective.getName());
}
}
/**
* Returns a List of strings (chosen from the given strings) which the last word in the given string array
* is a beginning-match for. (Tab completion).
*/
return getListOfStringsMatchingLastWord(args, (String[])list.toArray(new String[list.size()]));
}
else
{
return args.length == 2 ? getListOfStringsMatchingLastWord(args, new String[] {"add", "set"}): Collections.<String>emptyList();
}
}