本文整理汇总了Java中org.bukkit.scoreboard.Team.setDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Java Team.setDisplayName方法的具体用法?Java Team.setDisplayName怎么用?Java Team.setDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.scoreboard.Team
的用法示例。
在下文中一共展示了Team.setDisplayName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
}
}
示例2: 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);
}
}
示例3: 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);
}
}
示例4: loadTeam
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private void loadTeam(ConfigurationSection config, Team team) {
team.setDisplayName(config.getString("display_name", ""));
team.setPrefix(config.getString("prefix", ""));
team.setSuffix(config.getString("suffix", ""));
team.setOption(Option.COLLISION_RULE, toOptionStatus(config.getString("collisions", "")));
team.setOption(Option.DEATH_MESSAGE_VISIBILITY, toOptionStatus(config.getString("death_messages", "")));
team.setOption(Option.NAME_TAG_VISIBILITY, toOptionStatus(config.getString("name_tags", "")));
team.setAllowFriendlyFire(config.getBoolean("friendly_fire"));
team.setColor(toChatColor(config.getString("color", "")));
List<String> members = config.getStringList("members");
if (members != null) {
members.forEach(team::addEntry);
}
}
示例5: getTeam
import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private Team getTeam(int id, ScoreboardIndexableObject object)
{
Team team;
if (scoreboard.getScoreboard().getTeam(String.valueOf(id)) == null)
{
team = scoreboard.getScoreboard().registerNewTeam(String.valueOf(id));
}
else
{
team = scoreboard.getScoreboard().getTeam(String.valueOf(id));
}
String value = object.getValue();
if (object.getWatcher() != null)
{
value = value.replaceAll("%v%", object.getWatcher().get(scoreboard).toString());
}
String prefix = "", entry = "", suffix = "";
if (value.length() >= 31)
{
value = value.substring(0, 30);
}
ChatColor color = nextColor();
if (value.length() <= 16)
{
prefix = value;
suffix = "";
entry = color.toString();
}
else
{
if (value.charAt(15) == '&' || value.charAt(15) == '§')
{
prefix = value.substring(0, 15);
suffix = value.substring(15, value.length() >= 29 ? 29 : value.length());
}
else
{
prefix = value.substring(0, 16);
suffix = value.substring(16, value.length());
}
entry = color.toString();
}
while (suffix.length() != (16 - ChatColor.getLastColors(prefix).length()))
{
suffix += " ";
}
team.setPrefix(prefix);
team.setDisplayName(entry);
team.setSuffix(ChatColor.getLastColors(prefix) + suffix);
return team;
}