当前位置: 首页>>代码示例>>Java>>正文


Java Team.setDisplayName方法代码示例

本文整理汇总了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());
        }
    }
}
 
开发者ID:BlurEngine,项目名称:Blur,代码行数:26,代码来源:BlurTeam.java

示例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);
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:29,代码来源:ScoreboardMatchModule.java

示例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);
    }
}
 
开发者ID:Minehut,项目名称:GamePlate,代码行数:12,代码来源:ScoreboardModule.java

示例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);
	}
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:16,代码来源:ScoreboardPersister.java

示例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;
}
 
开发者ID:WoutDev,项目名称:Mega-Walls,代码行数:62,代码来源:UserScoreboardRunnable.java


注:本文中的org.bukkit.scoreboard.Team.setDisplayName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。