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


Java Team类代码示例

本文整理汇总了Java中org.bukkit.scoreboard.Team的典型用法代码示例。如果您正苦于以下问题:Java Team类的具体用法?Java Team怎么用?Java Team使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Team类属于org.bukkit.scoreboard包,在下文中一共展示了Team类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removePlayer

import org.bukkit.scoreboard.Team; //导入依赖的package包/类
public GameTeam removePlayer(Player p, boolean updateTab) {

        TeamLeaveEvent event = new TeamLeaveEvent(p, this);
        Bukkit.getPluginManager().callEvent(event);

        if (event.isCancelled()) return this;

        if (members.contains(p.getName())) {

            if (updateTab) {
                if (p.getScoreboard() != null) {

                    Scoreboard s = p.getScoreboard();

                    if (s.getTeam(this.getTeamName()) != null) {
                        Team team = s.getTeam(this.getRawTeamName());

                        team.removeEntry(p.getName());
                    }
                }
            }

            members.remove(p.getName());
        }
        return this;
    }
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:27,代码来源:GameTeam.java

示例2: createTeam

import org.bukkit.scoreboard.Team; //导入依赖的package包/类
private void createTeam() {
	String name = "ocmInternal";
	Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();

	Team team = null;

	for (Team t : scoreboard.getTeams()) {
		if (t.getName().equals(name)) {
			team = t;
			break;
		}
	}

	if (team == null)
		team = scoreboard.registerNewTeam(name);

	team.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.FOR_OWN_TEAM);
	team.setAllowFriendlyFire(true);
}
 
开发者ID:gvlfm78,项目名称:BukkitOldCombatMechanics,代码行数:20,代码来源:OCMMain.java

示例3: onTeamChange

import org.bukkit.scoreboard.Team; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onTeamChange(TeamChangeEvent event) {
    for (MatchTeam matchTeam : TGM.get().getModule(TeamManagerModule.class).getTeams()) {
        for (PlayerContext playerContext : matchTeam.getMembers()) {
            SimpleScoreboard simpleScoreboard = getScoreboard(playerContext.getPlayer());

            if (simpleScoreboard == null) {
                simpleScoreboard = initScoreboard(playerContext);
            }

            if (event.getOldTeam() != null) {
                Team old = simpleScoreboard.getScoreboard().getTeam(event.getOldTeam().getId());
                old.removeEntry(event.getPlayerContext().getPlayer().getName());
            }

            Team to = simpleScoreboard.getScoreboard().getTeam(event.getTeam().getId());
            to.addEntry(event.getPlayerContext().getPlayer().getName());
        }
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:21,代码来源:ScoreboardManagerModule.java

示例4: 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

示例5: 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

示例6: 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

示例7: parseInternal

import org.bukkit.scoreboard.Team; //导入依赖的package包/类
@Override
protected Team.OptionStatus parseInternal(Node node, String text) throws FormatException, InvalidXMLException {
    switch(node.getValue()) {
        case "yes":
        case "on":
        case "true":
            return Team.OptionStatus.ALWAYS;

        case "no":
        case "off":
        case "false":
            return Team.OptionStatus.NEVER;

        case "ally":
        case "allies":
            return Team.OptionStatus.FOR_OWN_TEAM;

        case "enemy":
        case "enemies":
            return Team.OptionStatus.FOR_OTHER_TEAMS;

        default:
            throw new InvalidXMLException("Invalid team relationship", node);
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:26,代码来源:TeamRelationParser.java

示例8: createPartyScoreboardTeam

import org.bukkit.scoreboard.Team; //导入依赖的package包/类
protected Team createPartyScoreboardTeam(Party party, Scoreboard scoreboard, boolean forObservers) {
    logger.fine("Creating team for party " + party + " on scoreboard " + toString(scoreboard));

    Team team = scoreboard.registerNewTeam(getScoreboardTeamName(party));
    updatePartyScoreboardTeam(party, team, forObservers);
    for(MatchPlayer player : party.getPlayers()) {
        team.addPlayer(player.getBukkit());
    }

    return team;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:12,代码来源:ScoreboardMatchModule.java

示例9: setupScoreboard

import org.bukkit.scoreboard.Team; //导入依赖的package包/类
private void setupScoreboard() {
    Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
    for(Team team : scoreboard.getTeams()) {
        team.unregister();
    }
    for(Objective objective : scoreboard.getObjectives()) {
        objective.unregister();
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:10,代码来源:Lobby.java

示例10: 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

示例11: 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

示例12: ScoreHelper

import org.bukkit.scoreboard.Team; //导入依赖的package包/类
private ScoreHelper(Player player, boolean healthName, boolean healthTab) {
	this.player = player;
	scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
	sidebar = scoreboard.registerNewObjective("sidebar", "dummy");
	sidebar.setDisplaySlot(DisplaySlot.SIDEBAR);
	player.setScoreboard(scoreboard);
	// Create Teams
	for(int i=1; i<=15; i++) {
		Team team = scoreboard.registerNewTeam("SLOT_" + i);
		team.addEntry(genEntry(i));
	}

	if(healthName) {
		Objective hName = scoreboard.registerNewObjective("hname", "health");
		hName.setDisplaySlot(DisplaySlot.BELOW_NAME);
		hName.setDisplayName(ChatColor.RED + "❤");
	}

	if(healthTab) {
		Objective hTab = scoreboard.registerNewObjective("htab", "health");
		hTab.setDisplaySlot(DisplaySlot.PLAYER_LIST);
	}

	players.put(player.getUniqueId(), this);
}
 
开发者ID:crisdev333,项目名称:ProScoreboard,代码行数:26,代码来源:ScoreHelper.java

示例13: 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

示例14: deactivate

import org.bukkit.scoreboard.Team; //导入依赖的package包/类
@Override
public void deactivate() {
    if (!activated) return;
    activated = false;
    // Set to the main scoreboard
    if (holder.isOnline()) {
        synchronized (this) {
            holder.setScoreboard((Bukkit.getScoreboardManager().getMainScoreboard()));
        }
    }
    // Unregister teams that are created for this scoreboard
    for (Team team : scoreboard.getTeams()) {
        team.unregister();
    }
    // Stop updating
    updateTask.cancel();
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:18,代码来源:SimpleScoreboard.java

示例15: CustomScoreboards

import org.bukkit.scoreboard.Team; //导入依赖的package包/类
public CustomScoreboards(MortuusTerraCore main) {
	this.main = main;
	ScoreboardManager manager = Bukkit.getScoreboardManager();

	pkTeamsBoard = manager.getNewScoreboard();

	pkTeamsBoard.registerNewTeam("NEUTRAL");
	pkTeamsBoard.registerNewTeam("ORANGE");
	pkTeamsBoard.registerNewTeam("RED");

	pkTeamsBoard.getTeam("NEUTRAL").setPrefix(PKStates.NEUTRAL.getColor() + "");
	pkTeamsBoard.getTeam("ORANGE").setPrefix(PKStates.ORANGE.getColor() + "");
	pkTeamsBoard.getTeam("RED").setPrefix(PKStates.RED.getColor() + "");

	for (Team team : pkTeamsBoard.getTeams()) {
		team.setOption(Option.NAME_TAG_VISIBILITY, OptionStatus.ALWAYS);
	}
}
 
开发者ID:kadeska,项目名称:MT_Core,代码行数:19,代码来源:CustomScoreboards.java


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