本文整理汇总了Java中org.spongepowered.api.scoreboard.displayslot.DisplaySlots类的典型用法代码示例。如果您正苦于以下问题:Java DisplaySlots类的具体用法?Java DisplaySlots怎么用?Java DisplaySlots使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DisplaySlots类属于org.spongepowered.api.scoreboard.displayslot包,在下文中一共展示了DisplaySlots类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onGameStarted
import org.spongepowered.api.scoreboard.displayslot.DisplaySlots; //导入依赖的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: execute
import org.spongepowered.api.scoreboard.displayslot.DisplaySlots; //导入依赖的package包/类
@Override
public void execute(SurvivalGame survivalGame) throws TextMessageException {
deadPlayer
.getScoreboard()
.getObjective(DisplaySlots.SIDEBAR)
.ifPresent(
objective -> {
objective.removeScore(Text.of(deadPlayer.getName()));
if (killingPlayer != null) {
Score k =
objective.getOrCreateScore(
Text.of(killingPlayer.getName()));
k.setScore(k.getScore() + 1);
}
});
}
开发者ID:m0pt0pmatt,项目名称:SurvivalGames,代码行数:17,代码来源:UpdateScoreBoardTask.java
示例3: swapBuffers
import org.spongepowered.api.scoreboard.displayslot.DisplaySlots; //导入依赖的package包/类
private void swapBuffers() {
this.scoreboard.updateDisplaySlot(this.buffer, DisplaySlots.SIDEBAR);
Objective temp = this.buffer;
this.buffer = this.objective;
this.objective = temp;
}
开发者ID:MinusKube,项目名称:Netherboard,代码行数:9,代码来源:SPlayerBoard.java
示例4: loadDefault
import org.spongepowered.api.scoreboard.displayslot.DisplaySlots; //导入依赖的package包/类
@Override
public void loadDefault() {
addDefault(Arrays.asList("actionbar", "bossbar", "title"), Arrays.asList(
SanctionService.MESSAGE_MUTE,
SanctionService.MESSAGE_JAIL,
InformationService.Priorities.NEWBIE_PLAYER,
InformationService.Priorities.NEWBIE_OTHERS,
InformationService.Priorities.CONNECTION_PLAYER,
InformationService.Priorities.CONNECTION_OTHERS,
"message",
WorldGuardService.Priorities.FLAG,
InformationService.Priorities.AUTOMESSAGE));
addDefault(Arrays.asList("nametag"), Arrays.asList(
InformationService.Priorities.NAMETAG));
addDefault(Arrays.asList("tablist"), Arrays.asList(
InformationService.Priorities.TABLIST));
addDefault(Arrays.asList("spawn"), Arrays.asList(
SpawnSubjectService.Priorities.NEWBIE,
WorldGuardService.Priorities.FLAG,
EssentialsService.Priorities.HOME,
SpawnSubjectService.Priorities.SPAWN,
SpawnService.Priorities.BED,
SpawnService.Priorities.WORLD));
addDefault(Arrays.asList("scoreboard:" + DisplaySlots.BELOW_NAME.getName().replaceFirst("minecraft:", "").toLowerCase()), Arrays.asList(
InformationService.Priorities.SCOREBOARD_BELOW_NAME));
addDefault(Arrays.asList("scoreboard:" + DisplaySlots.LIST.getName().replaceFirst("minecraft:", "").toLowerCase()), Arrays.asList(
InformationService.Priorities.SCOREBOARD_LIST));
addDefault(Arrays.asList("scoreboard:" + DisplaySlots.SIDEBAR.getName().replaceFirst("minecraft:", "").toLowerCase()), Arrays.asList(
InformationService.Priorities.SCOREBOARD_SIDEBAR));
}
开发者ID:EverCraft,项目名称:EverAPI,代码行数:37,代码来源:EPriorityConfig.java
示例5: getScoreBoard
import org.spongepowered.api.scoreboard.displayslot.DisplaySlots; //导入依赖的package包/类
public ConcurrentHashMap<DisplaySlot, ConcurrentHashMap<String, Integer>> getScoreBoard() {
ConcurrentHashMap<DisplaySlot, ConcurrentHashMap<String, Integer>> scoreboards = new ConcurrentHashMap<DisplaySlot, ConcurrentHashMap<String, Integer>>();
scoreboards.put(DisplaySlots.BELOW_NAME, this.getPriority("scoreboard." + DisplaySlots.BELOW_NAME.getName().toLowerCase()));
scoreboards.put(DisplaySlots.LIST, this.getPriority("scoreboard." + DisplaySlots.LIST.getName().toLowerCase()));
scoreboards.put(DisplaySlots.SIDEBAR, this.getPriority("scoreboard." + DisplaySlots.SIDEBAR.getName().toLowerCase()));
return scoreboards;
}
开发者ID:EverCraft,项目名称:EverAPI,代码行数:8,代码来源:EPriorityConfig.java
示例6: setBelownameHealth
import org.spongepowered.api.scoreboard.displayslot.DisplaySlots; //导入依赖的package包/类
private void setBelownameHealth(Scoreboard playerScoreboard, double currentHealth, String playerName) {
if (settings.getConfig().isBelowNameHealth()) {
Optional<Objective> optionalObjective = playerScoreboard.getObjective(DisplaySlots.BELOW_NAME);
optionalObjective.ifPresent(objective -> {
//make sure we are targeting our own objective on the correct display slot
if (objective.getName().equals(PomData.ARTIFACT_ID)) {
//we don't want to override other scoreboards
int displayedHealth = (int) Math.ceil(currentHealth);
objective.getOrCreateScore(Text.of(playerName)).setScore(displayedHealth);
}
});
}
}
开发者ID:games647,项目名称:HealthName,代码行数:14,代码来源:DamageListener.java
示例7: before
import org.spongepowered.api.scoreboard.displayslot.DisplaySlots; //导入依赖的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
示例8: display
import org.spongepowered.api.scoreboard.displayslot.DisplaySlots; //导入依赖的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
示例9: display
import org.spongepowered.api.scoreboard.displayslot.DisplaySlots; //导入依赖的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
示例10: DisplaySlotRegistryModule
import org.spongepowered.api.scoreboard.displayslot.DisplaySlots; //导入依赖的package包/类
public DisplaySlotRegistryModule() {
super(DisplaySlots.class);
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:DisplaySlotRegistryModule.java
注:本文中的org.spongepowered.api.scoreboard.displayslot.DisplaySlots类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论