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


Java Team.setPrefix方法代码示例

本文整理汇总了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;
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:25,代码来源:ScoreboardManagerModule.java

示例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();
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:17,代码来源:PlayerDataRPG.java

示例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);
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:22,代码来源:Party.java

示例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());
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:18,代码来源:ScoreBoard.java

示例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);
        }
    }
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:19,代码来源:FTeamWrapper.java

示例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);
}
 
开发者ID:crisdev333,项目名称:ProScoreboard,代码行数:17,代码来源:ScoreHelper.java

示例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());
	}
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:23,代码来源:PlayerManager.java

示例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());
        }
    }
}
 
开发者ID:BlurEngine,项目名称:Blur,代码行数:26,代码来源:BlurTeam.java

示例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);
	}
}
 
开发者ID:InventivetalentDev,项目名称:CompactNPCLib,代码行数:20,代码来源:NPCPlayer.java

示例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()));
}
 
开发者ID:Dytanic,项目名称:CloudNet,代码行数:14,代码来源:CloudServer.java

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

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

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

示例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] + "");
}
 
开发者ID:BurnyDaKath,项目名称:OMGPI,代码行数:15,代码来源:ObjectiveBuffer.java

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


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