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


Java Team.setOption方法代码示例

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


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

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

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

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

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

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

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

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

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

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

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

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

示例12: hpDisplayAndRegenTask

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public void hpDisplayAndRegenTask() {
    // HP Display
    if (board == null) {
        board = plugin.getServer().getScoreboardManager().getNewScoreboard();
        Objective objective = board.registerNewObjective("hpdisplay", "dummy");
        objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
        objective.setDisplayName(ChatColor.DARK_RED + "\u2764");
    }
    final Halter h = halter();
    RScheduler.scheduleRepeating(plugin, new Runnable() {
        int counter = 0;

        public void run() {
            if (isValid()) {
                if (dead)
                    return;
                counter++;
                if (counter % 2 == 0) {
                    int regenAmount = (int) (Math.ceil((baseMaxHP + maxHP) * getHPRegenRate()));
                    if (getSpellLevel(SpellbookReaper.RAPID_RECOVERY) > 0) {
                        int missing = baseMaxHP + maxHP - hp;
                        switch (getSpellLevel(SpellbookReaper.RAPID_RECOVERY)) {
                            case 1:
                                regenAmount += (int) (Math.ceil(missing * 0.0020));
                                break;
                            case 2:
                                regenAmount += (int) (Math.ceil(missing * 0.0025));
                                break;
                            case 3:
                                regenAmount += (int) (Math.ceil(missing * 0.0030));
                                break;
                            case 4:
                                regenAmount += (int) (Math.ceil(missing * 0.0035));
                                break;
                            case 5:
                                regenAmount += (int) (Math.ceil(missing * 0.0040));
                                break;
                        }
                    }
                    if (hasBuff(MysteryDrink.REGEN_BUFF_ID))
                        regenAmount += (int) (Math.ceil((baseMaxHP + maxHP) * getBuffValue(MysteryDrink.REGEN_BUFF_ID)));
                    if (hasBuff(SinisterStrike.DEBUFF_ID))
                        regenAmount *= 0.25;
                    if (regenAmount < 1)
                        regenAmount = 1;
                    if (region != null && region.dangerLevel == 1)
                        regenAmount *= 2;
                    regenAmount *= hpRegen;
                    hp += regenAmount;
                }
                if (hp > baseMaxHP + maxHP && finishedLoadEquips)
                    hp = baseMaxHP + maxHP;
                updateHealthManaDisplay();
            } else {
                h.halt = true;
            }
        }
    }, RTicks.seconds(0.5), h);

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


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