Java Code Examples for org.bukkit.scoreboard.Team#setDisplayName()

The following examples show how to use org.bukkit.scoreboard.Team#setDisplayName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScoreboardMatchModule.java    From PGM with GNU Affero General Public License v3.0 6 votes vote down vote up
protected void updatePartyScoreboardTeam(Party party, Team team, boolean forObservers) {
  match.getLogger().fine("Updating scoreboard team " + toString(team) + " for party " + party);

  team.setDisplayName(TextTranslations.translateLegacy(party.getName(), null));
  team.setPrefix(party.getColor().toString());
  team.setSuffix(ChatColor.WHITE.toString());

  team.setCanSeeFriendlyInvisibles(true);
  team.setAllowFriendlyFire(false);

  if (!forObservers && party instanceof Competitor) {
    NameTagVisibility nameTags = ((Competitor) party).getNameTagVisibility();

    team.setNameTagVisibility(nameTags);
  } else {
    team.setNameTagVisibility(NameTagVisibility.ALWAYS);
  }
}
 
Example 2
Source File: ScoreboardMatchModule.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
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);
    }
}
 
Example 3
Source File: UHTeam.java    From KTP with GNU General Public License v3.0 5 votes vote down vote up
public UHTeam(String name, String displayName, ChatColor color, UHPlugin plugin) {
	this.name = name;
	this.displayName = displayName;
	this.color = color;
	this.plugin = plugin;
	
	Scoreboard sb = this.plugin.getScoreboard();
	sb.registerNewTeam(this.name);

	Team t = sb.getTeam(this.name);
	t.setDisplayName(this.displayName);
	t.setCanSeeFriendlyInvisibles(true);
	t.setPrefix(this.color+"");
}