本文整理汇总了Java中org.bukkit.scoreboard.Team.addEntry方法的典型用法代码示例。如果您正苦于以下问题:Java Team.addEntry方法的具体用法?Java Team.addEntry怎么用?Java Team.addEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.scoreboard.Team
的用法示例。
在下文中一共展示了Team.addEntry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTeamChange
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onTeamChange(TeamChangeEvent event) {
for (MatchTeam matchTeam : TGM.get().getModule(TeamManagerModule.class).getTeams()) {
for (PlayerContext playerContext : matchTeam.getMembers()) {
SimpleScoreboard simpleScoreboard = getScoreboard(playerContext.getPlayer());
if (simpleScoreboard == null) {
simpleScoreboard = initScoreboard(playerContext);
}
if (event.getOldTeam() != null) {
Team old = simpleScoreboard.getScoreboard().getTeam(event.getOldTeam().getId());
old.removeEntry(event.getPlayerContext().getPlayer().getName());
}
Team to = simpleScoreboard.getScoreboard().getTeam(event.getTeam().getId());
to.addEntry(event.getPlayerContext().getPlayer().getName());
}
}
}
示例2: initScoreboard
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private SimpleScoreboard initScoreboard(PlayerContext playerContext) {
SimpleScoreboard simpleScoreboard = new SimpleScoreboard(ChatColor.AQUA + "Objectives");
for (MatchTeam matchTeam : TGM.get().getModule(TeamManagerModule.class).getTeams()) {
Team team = simpleScoreboard.getScoreboard().registerNewTeam(matchTeam.getId());
team.setPrefix(matchTeam.getColor().toString());
team.setCanSeeFriendlyInvisibles(false); // Fixes anti cheat entity visible when it shouldn't be
team.setAllowFriendlyFire(false);
team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
for (PlayerContext player : matchTeam.getMembers()) {
team.addEntry(player.getPlayer().getName());
}
}
Bukkit.getPluginManager().callEvent(new ScoreboardInitEvent(playerContext.getPlayer(), simpleScoreboard));
simpleScoreboard.send(playerContext.getPlayer());
scoreboards.put(playerContext.getPlayer(), simpleScoreboard);
simpleScoreboard.update();
return simpleScoreboard;
}
示例3: setRank
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
@Override
public void setRank(Rank r) {
rank = r;
Team t = board.getEntryTeam(name);
if (t != null)
t.removeEntry(name);
Team team = board.getTeam(rank.rankDisplayName);
if (team == null) {
team = board.registerNewTeam(rank.rankDisplayName);
team.setPrefix(rank.nameColor + "");
team.setAllowFriendlyFire(true);
team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
}
team.addEntry(name);
save();
}
示例4: updatePlayer
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public void updatePlayer(String name, int hp, Rank rank, boolean inParty) {
if (board == null)
return;
final Score score = board.getObjective("hpdisplay").getScore(name);
score.setScore(hp);
if (inParty) {
final Score score_side = board.getObjective("partyhpside").getScore(name);
score_side.setScore(hp);
}
Team team = board.getTeam(rank.rankDisplayName);
if (team == null) {
team = board.registerNewTeam(rank.rankDisplayName);
team.setPrefix(rank.nameColor + "");
team.setAllowFriendlyFire(true);
team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
}
if (!team.hasEntry(name))
team.addEntry(name);
}
示例5: ScoreHelper
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private ScoreHelper(Player player, boolean healthName, boolean healthTab) {
this.player = player;
scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
sidebar = scoreboard.registerNewObjective("sidebar", "dummy");
sidebar.setDisplaySlot(DisplaySlot.SIDEBAR);
player.setScoreboard(scoreboard);
// Create Teams
for(int i=1; i<=15; i++) {
Team team = scoreboard.registerNewTeam("SLOT_" + i);
team.addEntry(genEntry(i));
}
if(healthName) {
Objective hName = scoreboard.registerNewObjective("hname", "health");
hName.setDisplaySlot(DisplaySlot.BELOW_NAME);
hName.setDisplayName(ChatColor.RED + "❤");
}
if(healthTab) {
Objective hTab = scoreboard.registerNewObjective("htab", "health");
hTab.setDisplaySlot(DisplaySlot.PLAYER_LIST);
}
players.put(player.getUniqueId(), this);
}
示例6: updateTeamFields
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public void updateTeamFields(@Nonnull Team team, boolean updatePlayers) {
if (!team.getDisplayName().equals(getName())) {
team.setDisplayName(getName());
}
if (!team.getPrefix().equals(getChatPrefix())) {
team.setPrefix(getChatPrefix());
}
if (!team.getOption(Option.NAME_TAG_VISIBILITY).equals(getNametagVisibility().getBukkit())) {
team.setOption(Option.NAME_TAG_VISIBILITY, getNametagVisibility().getBukkit());
}
if (!team.getOption(Option.DEATH_MESSAGE_VISIBILITY).equals(getDeathMessageVisibility().getBukkit())) {
team.setOption(Option.DEATH_MESSAGE_VISIBILITY, getDeathMessageVisibility().getBukkit());
}
if (!team.getOption(Option.COLLISION_RULE).equals(getCollisionRule().getBukkit())) {
team.setOption(Option.COLLISION_RULE, getCollisionRule().getBukkit());
}
if (updatePlayers) {
Set<String> oldEntries = players.stream().map(BlurPlayer::getName).collect(Collectors.toSet());
oldEntries.removeAll(team.getEntries());
oldEntries.forEach(team::removeEntry);
for (BlurPlayer blurPlayer : players) {
team.addEntry(blurPlayer.getName());
}
}
}
示例7: addPlayerToScoreboard
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public void addPlayerToScoreboard(Player p) {
String name = p.getName();
if (p.getScoreboard().getEntryTeam(p.getName()) != null) return;
World w = p.getWorld();
List<?> worlds = Config.getWorlds("disable-player-collision");
if (worlds.isEmpty() || worlds.contains(w.getName())) {
Team team = Bukkit.getScoreboardManager().getMainScoreboard().getTeam("ocmInternal");
if (!team.getEntries().contains(name)) {
team.addEntry(name);
}
} else if (!worlds.contains(w.getName())) {
removePlayerFromScoreboard(p);
}
}
示例8: refreshScoreboard
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public void refreshScoreboard() {
Team team = getScoreboardTeam();
for (String entry : team.getEntries()) {
team.removeEntry(entry);
}
team.addEntry(getBukkitEntity().getName());
team.setPrefix(Strings.nullToEmpty(scoreboardPrefix));
team.setSuffix(Strings.nullToEmpty(scoreboardSuffix));
if (nameHidden) {
// team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER);
team.setNameTagVisibility(NameTagVisibility.NEVER);
} else {
// team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.ALWAYS);
team.setNameTagVisibility(NameTagVisibility.ALWAYS);
}
}
示例9: addTeamEntry
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private void addTeamEntry(Player target, Player all, PermissionGroup permissionGroup)
{
Team team = all.getScoreboard().getTeam(permissionGroup.getTagId() + permissionGroup.getName());
if (team == null)
team = all.getScoreboard().registerNewTeam(permissionGroup.getTagId() + permissionGroup.getName());
team.setPrefix(ChatColor.translateAlternateColorCodes('&', permissionGroup.getPrefix()));
team.setSuffix(ChatColor.translateAlternateColorCodes('&', permissionGroup.getSuffix()));
team.addEntry(target.getName());
target.setDisplayName(ChatColor.translateAlternateColorCodes('&', permissionGroup.getDisplay() + target.getName()));
}
示例10: add
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private void add(FScoreboard fboard) {
Scoreboard board = fboard.getScoreboard();
Team team = board.registerNewTeam(teamName);
teams.put(fboard, team);
for (OfflinePlayer player : getPlayers()) {
team.addEntry(player.getName());
}
updatePrefix(fboard);
}
示例11: addPlayer
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private void addPlayer(OfflinePlayer player) {
if (members.add(player)) {
for (Team team : teams.values()) {
team.addEntry(player.getName());
}
}
}
示例12: applyTeam
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
void applyTeam(String code, String left, String right) {
Team team = scoreboard.getTeam(code);
if (team == null) {
team = scoreboard.registerNewTeam(code);
}
if (!team.hasEntry(code)) {
team.addEntry(code);
}
team.setPrefix(left);
team.setSuffix(right);
}
示例13: loadInto
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
/**
* Load scoreboard into custom objective.
* @param o Given objective.
*/
public void loadInto(Objective o) {
for (int i = 0; i < 16; i++)
if (lines.size() > i && lines.get(i) != null) {
o.getScore(ChatColor.values()[i] + "").setScore(lines.size() - i);
Team t = o.getScoreboard().getTeam(i + "");
if (t == null) t = o.getScoreboard().registerNewTeam(i + "");
t.addEntry(ChatColor.values()[i] + "");
t.setPrefix(lines.get(i).substring(0, Math.min(14, lines.get(i).length())));
} else o.getScoreboard().resetScores(ChatColor.values()[i] + "");
}
示例14: Board
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public Board(String displayname, String... newlines) {
Validate.isTrue(newlines.length < COLORS.size() - 3, "Too many lines to display.");
scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
objective = scoreboard.registerNewObjective("Infoboard", "dummy");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
objective.setDisplayName(displayname);
for (int i = 0; i < COLORS.size() - 3; i++) {
final ChatColor color = COLORS.get(i);
final Team team = scoreboard.registerNewTeam("line" + i);
team.addEntry(color.toString());
lines.add(new InfoBoard(color, i, team));
}
for (int i = 0; i < newlines.length; i++)
setValue(i, newlines[i]);
}
示例15: addToTeam
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private void addToTeam(Player p) {
Scoreboard s = p.getScoreboard() != null ? p.getScoreboard() : Bukkit.getScoreboardManager().getMainScoreboard();
Team t = s.getTeam("AeroCollide");
if(t == null) {
s.registerNewTeam("AeroCollide");
t = s.getTeam("AeroCollide");
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "scoreboard teams options AeroCollide collisionRule never");
}
t.addEntry(p.getName());
p.setScoreboard(s);
}