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


Java Team.setAllowFriendlyFire方法代码示例

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


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

示例6: FriendlyFireModule

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public FriendlyFireModule() {
    for (ScoreboardModule scoreboardModule : GameHandler.getGameHandler().getMatch().getModules().getModules(ScoreboardModule.class)) {
        for (Team team : scoreboardModule.getSimpleScoreboard().getScoreboard().getTeams()) {
            team.setAllowFriendlyFire(false);
        }
    }
}
 
开发者ID:Minehut,项目名称:GamePlate,代码行数:8,代码来源:FriendlyFireModule.java

示例7: onTeamCreate

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
@EventHandler
public void onTeamCreate(TeamCreateEvent event) {
    for (ScoreboardModule scoreboardModule : GameHandler.getGameHandler().getMatch().getModules().getModules(ScoreboardModule.class)) {
        for (Team team : scoreboardModule.getSimpleScoreboard().getScoreboard().getTeams()) {
            team.setAllowFriendlyFire(false);
        }
    }
}
 
开发者ID:Minehut,项目名称:GamePlate,代码行数:9,代码来源:FriendlyFireModule.java

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

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