本文整理汇总了Java中org.spongepowered.api.scoreboard.critieria.Criteria类的典型用法代码示例。如果您正苦于以下问题:Java Criteria类的具体用法?Java Criteria怎么用?Java Criteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Criteria类属于org.spongepowered.api.scoreboard.critieria包,在下文中一共展示了Criteria类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onGameStarted
import org.spongepowered.api.scoreboard.critieria.Criteria; //导入依赖的package包/类
@Listener
//Scoreboards are loaded when the world is loaded so load it here
public void onGameStarted(GameStartedServerEvent gameStartedServerEvent) {
Optional<Scoreboard> serverScoreboard = Sponge.getServer().getServerScoreboard();
if (serverScoreboard.isPresent()) {
Scoreboard globalScoreboard = serverScoreboard.get();
if (configuration.getConfig().isNametagHealth()) {
globalScoreboard.getObjective(PomData.ARTIFACT_ID).ifPresent(globalScoreboard::removeObjective);
Objective objective = Objective.builder()
.name(PomData.ARTIFACT_ID)
.displayName(Text.of(TextColors.DARK_RED, "Health"))
.criterion(Criteria.DUMMY)
.objectiveDisplayMode(ObjectiveDisplayModes.INTEGER)
.build();
globalScoreboard.addObjective(objective);
globalScoreboard.updateDisplaySlot(objective, DisplaySlots.BELOW_NAME);
}
} else {
logger.warn("Global scoreboard couldn't be loaded");
}
}
开发者ID:games647,项目名称:HealthName,代码行数:23,代码来源:HealthName.java
示例2: ScoreTypes
import org.spongepowered.api.scoreboard.critieria.Criteria; //导入依赖的package包/类
public ScoreTypes(EverAPI plugin) {
register(new ScoreHealth("HEALTH_HEARTS", plugin, Criteria.HEALTH, ObjectiveDisplayModes.HEARTS));
register(new ScoreHealth("HEALTH", plugin, Criteria.HEALTH));
register(new ScoreOnlinePlayersCanSee("ONLINE_PLAYERS_CANSEE", plugin));
register(new ScoreBalance("BALANCE", plugin));
register(new ScorePing("PING", plugin));
register(new ScoreFeed("FEED", plugin));
register(new ScoreLevel("LEVEL", plugin));
register(new ScoreXp("XP", plugin));
register(new ScoreDeath("DEATHS", plugin));
register(new ScoreKill("KILLS", plugin));
register(new ScoreRatio("RATIO", plugin));
register(new ScoreDeathMonthly("DEATHS_MONTHLY", plugin));
register(new ScoreKillMonthly("KILLS_MONTHLY", plugin));
register(new ScoreRatioMonthly("RATIO_MONTHLY", plugin));
register(new ScoreHelmet("HELMET", plugin));
register(new ScoreChestplate("CHESTPLATE", plugin));
register(new ScoreLeggings("LEGGINGS", plugin));
register(new ScoreBoots("BOOTS", plugin));
register(new ScoreHelmetMax("HELMET_MAX", plugin));
register(new ScoreChestplateMax("CHESTPLATE_MAX", plugin));
register(new ScoreLeggingsMax("LEGGINGS_MAX", plugin));
register(new ScoreBootsMax("BOOTS_MAX", plugin));
register(new ScoreHelmetPercent("HELMET_PERCENT", plugin));
register(new ScoreChestplatePercent("CHESTPLATE_PERCENT", plugin));
register(new ScoreLeggingsPercent("LEGGINGS_PERCENT", plugin));
register(new ScoreBootsPercent("BOOTS_PERCENT", plugin));
}
开发者ID:EverCraft,项目名称:EverAPI,代码行数:29,代码来源:ScoreType.java
示例3: before
import org.spongepowered.api.scoreboard.critieria.Criteria; //导入依赖的package包/类
@Override
public void before(SurvivalGame survivalGame) {
scoreboard = Scoreboard.builder().build();
objective =
Objective.builder()
.criterion(Criteria.DUMMY)
.name("ssg-" + survivalGame.getName())
.displayName(Text.of("Remaining Players"))
.build();
scoreboard.addObjective(objective);
scoreboard.updateDisplaySlot(objective, DisplaySlots.SIDEBAR);
}
开发者ID:m0pt0pmatt,项目名称:SurvivalGames,代码行数:15,代码来源:CreateScoreboardTask.java
示例4: display
import org.spongepowered.api.scoreboard.critieria.Criteria; //导入依赖的package包/类
private void display(CommandSource src, PlayerStats stats) {
if (src instanceof Player && settings.getConfig().isScoreboardDisplay()) {
Player receiver = (Player) src;
Objective objective = Objective.builder()
.displayName(Text.of(TextColors.DARK_RED, stats.getPlayername()))
.name("playerstats")
.criterion(Criteria.DUMMY)
.objectiveDisplayMode(ObjectiveDisplayModes.INTEGER)
.build();
objective.getOrCreateScore(Text.of(TextColors.YELLOW, "Kills")).setScore(stats.getPlayerKills());
objective.getOrCreateScore(Text.of(TextColors.YELLOW, "MobKills")).setScore(stats.getMobKills());
objective.getOrCreateScore(Text.of(TextColors.YELLOW, "Deaths")).setScore(stats.getDeaths());
Scoreboard tempScoreboard = Scoreboard.builder()
.objectives(Collections.singletonList(objective))
.build();
tempScoreboard.updateDisplaySlot(objective, DisplaySlots.SIDEBAR);
receiver.setScoreboard(tempScoreboard);
UUID uuid = receiver.getUniqueId();
Task.builder().delay(5, TimeUnit.SECONDS)
.execute(() -> Sponge.getServer().getPlayer(uuid).ifPresent(player -> {
Scoreboard scoreboard = player.getScoreboard();
scoreboard.getObjective("playerstats").ifPresent(scoreboard::removeObjective);
})).submit(plugin);
} else {
src.sendMessage(Text.of(TextColors.YELLOW, "Kills: " + stats.getPlayerKills()));
src.sendMessage(Text.of(TextColors.YELLOW, "Mob kills: " + stats.getMobKills()));
src.sendMessage(Text.of(TextColors.YELLOW, "Deaths: " + stats.getDeaths()));
}
}
开发者ID:games647,项目名称:TrackMe,代码行数:34,代码来源:StatsCommand.java
示例5: display
import org.spongepowered.api.scoreboard.critieria.Criteria; //导入依赖的package包/类
private void display(Player receiver, int page, Collection<PlayerStats> topEntries) {
if (settings.getConfig().isScoreboardDisplay()) {
Objective objective = Objective.builder()
.displayName(Text.of(TextColors.GOLD, "Page ", page))
.name("topstats")
.criterion(Criteria.DUMMY)
.objectiveDisplayMode(ObjectiveDisplayModes.INTEGER)
.build();
if (topEntries.isEmpty()) {
objective.getOrCreateScore(Text.of(TextColors.DARK_RED, "No entries")).setScore(-1);
} else {
int rank = (page - 1) * 10 + 1;
for (PlayerStats topEntry : topEntries) {
String playerName = topEntry.getPlayername();
int playerKills = topEntry.getPlayerKills();
objective.getOrCreateScore(Text.of(TextColors.DARK_AQUA, rank, ". ", playerName)).setScore(playerKills);
rank++;
}
}
Scoreboard tempScoreboard = Scoreboard.builder()
.objectives(Collections.singletonList(objective))
.build();
tempScoreboard.updateDisplaySlot(objective, DisplaySlots.SIDEBAR);
receiver.setScoreboard(tempScoreboard);
UUID uuid = receiver.getUniqueId();
Task.builder().delay(5, TimeUnit.SECONDS)
.execute(() -> Sponge.getServer().getPlayer(uuid).ifPresent(player -> {
Scoreboard scoreboard = player.getScoreboard();
scoreboard.getObjective("playerstats").ifPresent(scoreboard::removeObjective);
})).submit(plugin);
} else {
displayText(receiver, page, topEntries);
}
}
开发者ID:games647,项目名称:TrackMe,代码行数:38,代码来源:TopCommand.java
示例6: CriterionRegistryModule
import org.spongepowered.api.scoreboard.critieria.Criteria; //导入依赖的package包/类
public CriterionRegistryModule() {
super(Criteria.class);
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:CriterionRegistryModule.java
示例7: isModifiable
import org.spongepowered.api.scoreboard.critieria.Criteria; //导入依赖的package包/类
@Override
public boolean isModifiable() throws IllegalStateException {
checkState();
// TODO: I might try to get a method into SpongeAPI, but this will do for now
return getHandle().getCriterion() == Criteria.HEALTH;
}
开发者ID:LapisBlue,项目名称:Pore,代码行数:7,代码来源:PoreObjective.java
注:本文中的org.spongepowered.api.scoreboard.critieria.Criteria类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论