本文整理汇总了Java中org.bukkit.scoreboard.Team.setPrefix方法的典型用法代码示例。如果您正苦于以下问题:Java Team.setPrefix方法的具体用法?Java Team.setPrefix怎么用?Java Team.setPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.scoreboard.Team
的用法示例。
在下文中一共展示了Team.setPrefix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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();
}
示例3: 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);
}
示例4: refreshPlayer
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public void refreshPlayer(KingdomFactionsPlayer p) {
Team team;
if (getBoard().getTeam(p.getKingdom().getType().toString() + getExtraTeamSuffix(p)) == null) {
team = getBoard().registerNewTeam(p.getKingdom().getType().toString() + getExtraTeamSuffix(p));
} else {
team = getBoard().getTeam(p.getKingdom().getType().toString() + getExtraTeamSuffix(p));
}
team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
if (p.isStaff()) {
team.setPrefix(p.getKingdom().getType().getColor() + "" + ChatColor.BOLD + "");
} else {
team.setPrefix(p.getKingdom().getType().getColor() + "");
}
team.addPlayer(p.getPlayer());
}
示例5: updatePrefix
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private void updatePrefix(FScoreboard fboard) {
if (plugin.getFConfig().getDefaultScoreboardPrefixes()) {
FPlayer fplayer = fboard.getFPlayer();
Team team = teams.get(fboard);
String prefix = plugin.getFConfig().getNametagPrefix();
prefix = ParsingUtil.replaceRelationPlaceholders(prefix, faction, fplayer);
prefix = ParsingUtil.replaceFactionPlaceholders(prefix, faction);
// Avoid client bug
if (prefix.length() > 16) {
prefix = prefix.substring(0, 15);
}
if (team.getPrefix() == null || !team.getPrefix().equals(prefix)) {
team.setPrefix(prefix);
}
}
}
示例6: setSlot
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public void setSlot(int slot, String text) {
Team team = scoreboard.getTeam("SLOT_" + slot);
String entry = genEntry(slot);
if(!scoreboard.getEntries().contains(entry)) {
sidebar.getScore(entry).setScore(slot);
}
text = PlaceholderAPI.setPlaceholders(player, text);
String pre = getFirstSplit(text);
String suf = getFirstSplit(ChatColor.getLastColors(pre) + getSecondSplit(text));
if(!team.getPrefix().equals(pre))
team.setPrefix(pre);
if(!team.getSuffix().equals(suf))
team.setSuffix(suf);
}
示例7: refreshTeam
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public void refreshTeam(VPPlayer player){
Team t2 = Bukkit.getScoreboardManager().getMainScoreboard().getPlayerTeam(player.getPlayer());
if(t2 != null && !t2.getName().startsWith("_VP_"))
return;
if(player.isNick()){
nick.addPlayer(player.getPlayer());
}else{
String name = intFormat.format(1000-player.getGroupLevel());
Team t = Bukkit.getScoreboardManager().getMainScoreboard().getTeam(name);
if(t == null)
t = Bukkit.getScoreboardManager().getMainScoreboard().registerNewTeam(name);
if(player.getPrefix().length()>16)
t.setPrefix(player.getPrefix().substring(0, 16));
else
t.setPrefix(player.getPrefix());
if(player.getSuffix().length()>16)
t.setSuffix(player.getSuffix().substring(0, 16));
else
t.setSuffix(player.getSuffix());
t.addPlayer(player.getPlayer());
}
}
示例8: 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());
}
}
}
示例9: 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);
}
}
示例10: 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()));
}
示例11: updatePartyScoreboardTeam
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
protected void updatePartyScoreboardTeam(Party party, Team team, boolean forObservers) {
logger.fine("Updating scoreboard team " + toString(team) + " for party " + party);
team.setDisplayName(party.getName());
team.setPrefix(party.getColor().toString());
team.setSuffix(ChatColor.WHITE.toString());
team.setCanSeeFriendlyInvisibles(true);
team.setAllowFriendlyFire(getMatch().getMapInfo().friendlyFire);
team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
if(!forObservers && party instanceof Competitor) {
Team.OptionStatus nameTags = ((Competitor) party).getNameTagVisibility();
// #HACK until this is fixed https://bugs.mojang.com/browse/MC-48730 we need to
// ensure enemy name tags are always hidden for GS.
if(getMatch().getMatchModule(GhostSquadronMatchModule.class) != null) {
switch(nameTags) {
case ALWAYS: nameTags = Team.OptionStatus.FOR_OWN_TEAM; break;
case FOR_OTHER_TEAMS: nameTags = Team.OptionStatus.NEVER; break;
}
}
team.setOption(Team.Option.NAME_TAG_VISIBILITY, nameTags);
} else {
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.ALWAYS);
}
}
示例12: setOverheadNamePrefix
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
/**
* Sets a prefix for a player's overhead name by adding them to a scoreboard team.
* Don't use this if scoreboard teams are being used for any other purpose.
*/
private static void setOverheadNamePrefix(Player player, String prefix) {
final Scoreboard scoreboard = player.getServer().getScoreboardManager().getMainScoreboard();
prefix = prefix.substring(0, Math.min(prefix.length(), 14));
Team team = scoreboard.getTeam(prefix);
if(team == null) {
team = scoreboard.registerNewTeam(prefix);
team.setPrefix(prefix);
team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
}
team.addPlayer(player);
}
示例13: 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);
}
示例14: 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] + "");
}
示例15: setupTeam
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private void setupTeam(TeamModule teamModule) {
Team team = this.simpleScoreboard.getScoreboard().registerNewTeam(teamModule.getId());
team.setDisplayName(teamModule.getName());
team.setPrefix(teamModule.getColor() + "[" + teamModule.getName().substring(0, 1) + "] ");
team.setCanSeeFriendlyInvisibles(true);
team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
for (Player player : teamModule.getPlayers()) {
team.addPlayer(player);
}
}