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


Java Team.addEntry方法代码示例

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


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

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

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

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

示例7: addPlayerToScoreboard

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public void addPlayerToScoreboard(Player p) {

        String name = p.getName();
        if (p.getScoreboard().getEntryTeam(p.getName()) != null) return;

        World w = p.getWorld();
        List<?> worlds = Config.getWorlds("disable-player-collision");

        if (worlds.isEmpty() || worlds.contains(w.getName())) {
            Team team = Bukkit.getScoreboardManager().getMainScoreboard().getTeam("ocmInternal");
            if (!team.getEntries().contains(name)) {
                team.addEntry(name);
            }
        } else if (!worlds.contains(w.getName())) {
            removePlayerFromScoreboard(p);
        }
    }
 
开发者ID:gvlfm78,项目名称:BukkitOldCombatMechanics,代码行数:18,代码来源:OCMTask.java

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

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

示例10: add

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private void add(FScoreboard fboard) {
    Scoreboard board = fboard.getScoreboard();
    Team team = board.registerNewTeam(teamName);
    teams.put(fboard, team);

    for (OfflinePlayer player : getPlayers()) {
        team.addEntry(player.getName());
    }

    updatePrefix(fboard);
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:12,代码来源:FTeamWrapper.java

示例11: addPlayer

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private void addPlayer(OfflinePlayer player) {
    if (members.add(player)) {
        for (Team team : teams.values()) {
            team.addEntry(player.getName());
        }
    }
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:8,代码来源:FTeamWrapper.java

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

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

示例14: Board

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
public Board(String displayname, String... newlines) {
	Validate.isTrue(newlines.length < COLORS.size() - 3, "Too many lines to display.");
	scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
	objective = scoreboard.registerNewObjective("Infoboard", "dummy");
	objective.setDisplaySlot(DisplaySlot.SIDEBAR);
	objective.setDisplayName(displayname);
	for (int i = 0; i < COLORS.size() - 3; i++) {
		final ChatColor color = COLORS.get(i);
		final Team team = scoreboard.registerNewTeam("line" + i);
		team.addEntry(color.toString());
		lines.add(new InfoBoard(color, i, team));
	}
	for (int i = 0; i < newlines.length; i++)
		setValue(i, newlines[i]);
}
 
开发者ID:NJDaeger,项目名称:EssentialCommands,代码行数:16,代码来源:Board.java

示例15: addToTeam

import org.bukkit.scoreboard.Team; //导入方法依赖的package包/类
private void addToTeam(Player p) {
    Scoreboard s = p.getScoreboard() != null ? p.getScoreboard() : Bukkit.getScoreboardManager().getMainScoreboard();
    Team t = s.getTeam("AeroCollide");
    if(t == null) {
        s.registerNewTeam("AeroCollide");
        t = s.getTeam("AeroCollide");
        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "scoreboard teams options AeroCollide collisionRule never");
    }
    t.addEntry(p.getName());
    p.setScoreboard(s);
}
 
开发者ID:Tom7653,项目名称:Aero,代码行数:12,代码来源:Colliding.java


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