Java 类org.bukkit.scoreboard.Score 实例源码

项目:AthenaGM    文件:ScoreboardModule.java   
/**
 * Set up the sidebar score box
 */
private void createSidebarTeamScoreObjective(Match match) {

    Scoreboard board = boards.get(match);
    Objective objective = board.registerNewObjective("matchscore", "dummy");
    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    objective.setDisplayName(String.format("Match %s(00:00)", ChatColor.AQUA));

    // Create score lines for each team
    for (Team team : match.getTeams().values()) {
        if (!team.isSpectator()) {
            Score score = objective.getScore(team.getChatColor() + team.getName());
            score.setScore(0);
        }
    }

}
项目:ZentrelaRPG    文件:Party.java   
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);
}
项目:SurvivalPlus    文件:Valkyrie.java   
@SuppressWarnings("deprecation")
private void Spin(final Player player)
{       
    Score score = spin.getScore(player);
    score.setScore(1);

       particleCircle(player, 50, 2.5f, ParticleEffect.CRIT);
       particleCircle(player, 25, 2f, ParticleEffect.CRIT);
       particleCircle(player, 10, 2.5f, ParticleEffect.CRIT_MAGIC);

    Random rand = new Random();
       player.getLocation().getWorld().playSound(player.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 1.5F, rand.nextFloat() * 0.4F + 0.8F);

    damageNearbyEnemies(player, 8);

    Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Survival.instance, new Runnable()
    {
        Score score = spin.getScore(player);
        public void run()
        {
            score.setScore(0);
           }
    },
    20L);
}
项目:BlockBall    文件:SimpleScoreboard.java   
/**
 * Updates the given text for the line and given objectiveName
 *
 * @param objectiveName objectiveName
 * @param line          line
 * @param text          text
 * @return scoreboard
 */
public SimpleScoreboard setLine(String objectiveName, int line, String text) {
    final Objective objective = this.getObjective(objectiveName);
    final Objective bufferObjective;
    if (objective.getName().endsWith("_buf")) {
        bufferObjective = this.scoreboard.registerNewObjective(objectiveName.substring(0, objective.getName().indexOf("_buf")), objective.getCriteria());
    } else {
        bufferObjective = this.scoreboard.registerNewObjective(objectiveName + "_buf", objective.getCriteria());
    }
    for (final String s : this.scoreboard.getEntries()) {
        final Score score = objective.getScore(s);
        if (score.getScore() != 0 && score.getScore() != line) {
            bufferObjective.getScore(s).setScore(score.getScore());
        }
    }
    if (text != null) {
        bufferObjective.getScore(ChatColor.translateAlternateColorCodes('&', text)).setScore(line);
    }
    bufferObjective.setDisplayName(objective.getDisplayName());
    bufferObjective.setDisplaySlot(objective.getDisplaySlot());
    objective.unregister();
    return this;
}
项目:Breakpoint    文件:CTFGame.java   
public void updateProgressObjectiveScore()
{
    int[] flagScores = getFlagManager().getScore();
    OfflinePlayer[] fakePlayers = new OfflinePlayer[]
            {
            Bukkit.getOfflinePlayer(MessageType.SCOREBOARD_PROGRESS_CTF_TEAM_RED.getTranslation().getValue()),
            Bukkit.getOfflinePlayer(MessageType.SCOREBOARD_PROGRESS_CTF_TEAM_BLUE.getTranslation().getValue())
            };

    for(BPPlayer bpPlayer : players)
    {
        SBManager sbm = bpPlayer.getScoreboardManager();
        Objective progressObj = sbm.getProgressObj();

        for (int i = 0; i < fakePlayers.length; i++)
        {
            Score score = progressObj.getScore(fakePlayers[i]);
            score.setScore(flagScores[i]);
        }
    }
}
项目:CubeKrowd-Icerunner    文件:Scoreboardmanager.java   
public void create(){
    ScoreboardManager manager = Bukkit.getScoreboardManager();
    board = manager.getNewScoreboard();
    teamRed = board.registerNewTeam("Red");
    teamRed.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
    teamRed.setAllowFriendlyFire(false);
    teamGreen = board.registerNewTeam("Green");
    teamGreen.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
    teamGreen.setAllowFriendlyFire(false);
    objective = board.registerNewObjective("time", "dummy");
    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    objective.setDisplayName("Time");
    Score scoreRed = objective.getScore(ChatColor.RED + "Red:");
    scoreRed.setScore(Game.getGame().getCurrentArena().maxPoints);
    Score scoreGreen = objective.getScore(ChatColor.GREEN + "Green:");
    scoreGreen.setScore(Game.getGame().getCurrentArena().maxPoints);
    teamRed.setPrefix(ChatColor.RED.toString());
    teamGreen.setPrefix(ChatColor.GREEN.toString());
    teamRed.setSuffix(ChatColor.WHITE.toString());
    teamGreen.setSuffix(ChatColor.WHITE.toString());
}
项目:ExtremeSurvival    文件:ScoreboardManagement.java   
public static void createScoreboard(Player p ){
    Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
    Objective obj = scoreboard.registerNewObjective("Info", "dummy");
    int sec = (int) (Main.getES().getBorder().whenPurge()/1000);
    if(sec < 0){
        obj.setDisplayName("Czystka Trwa!");
    }else{
        obj.setDisplayName("Czystka za "+Main.formatIntoHHMMSS(sec));
    }

    obj.setDisplaySlot(DisplaySlot.SIDEBAR);
    Score s = obj.getScore(ChatColor.GREEN+"Serwer Purge");
    s.setScore(-1);
    Score size = obj.getScore(ChatColor.BOLD+""+ChatColor.GREEN+Main.getES().getBorder().getSize()/2+"");
    size.setScore(-2);
    p.setScoreboard(scoreboard);
}
项目:Breakpoint    文件:CTFGame.java   
public void updateProgressObjectiveScore()
{
    int[] flagScores = getFlagManager().getScore();
    OfflinePlayer[] fakePlayers = new OfflinePlayer[]
            {
            Bukkit.getOfflinePlayer(MessageType.SCOREBOARD_PROGRESS_CTF_TEAM_RED.getTranslation().getValue()),
            Bukkit.getOfflinePlayer(MessageType.SCOREBOARD_PROGRESS_CTF_TEAM_BLUE.getTranslation().getValue())
            };

    for(BPPlayer bpPlayer : players)
    {
        SBManager sbm = bpPlayer.getScoreboardManager();
        Objective progressObj = sbm.getProgressObj();

        for (int i = 0; i < fakePlayers.length; i++)
        {
            Score score = progressObj.getScore(fakePlayers[i]);
            score.setScore(flagScores[i]);
        }
    }
}
项目:libelula    文件:ScoreManager.java   
public void setScoreboard(Player player) {
    if (scoreBoards.containsKey(player)) {
        player.setScoreboard(scoreBoards.get(player).getScoreboard());
    } else {
        Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
        Objective sideBar = board.registerNewObjective("player", "score");
        sideBar.setDisplaySlot(DisplaySlot.SIDEBAR);
        sideBar.setDisplayName(plugin.lm.getTranslatedText("scoreboard-title"));
        Team team = board.registerNewTeam("dummy");
        team.addPlayer(Bukkit.getOfflinePlayer(plugin.lm.getTranslatedText("scoreboard-score")));
        team.addPlayer(Bukkit.getOfflinePlayer(plugin.lm.getTranslatedText("scoreboard-total-score")));
        scoreBoards.put(player, sideBar);
        final Score playerScore = scoreBoards.get(player).getScore(Bukkit.getOfflinePlayer(plugin.lm.getTranslatedText("scoreboard-score")));
        final Score playerTotalScore = scoreBoards.get(player).getScore(Bukkit.getOfflinePlayer(plugin.lm.getTranslatedText("scoreboard-total-score")));
        playerScore.setScore(0);
        Integer total = scores.get(player.getName());
        if (total != null) {
            playerTotalScore.setScore(total);
        } else {
            playerTotalScore.setScore(0);
        }
        player.setScoreboard(board);
    }
}
项目:gFeatures    文件:GlidersScore.java   
public Scoreboard Initialize(Player p) throws IllegalStateException, IllegalArgumentException{
    ScoreboardManager manager = Bukkit.getScoreboardManager();
    Scoreboard board = manager.getNewScoreboard();
    Objective objective = board.registerNewObjective("test", "dummy");
    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    objective.setDisplayName(ChatColor.GOLD + "" + ChatColor.BOLD + "     _Esti" + ChatColor.DARK_AQUA + "" + ChatColor.BOLD +"Net_     ");
    Score score2 = objective.getScore(ChatColor.DARK_BLUE + "Online:"); //Get a fake offline player
    score2.setScore(12);
    Score score3 = objective.getScore(ChatColor.BOLD + "" + Integer.toString(Bukkit.getServer().getOnlinePlayers().size())); //Get a fake offline player
    score3.setScore(11);
    Score score7 = objective.getScore(ChatColor.GREEN + "Time left:"); //Get a fake offline player
    score7.setScore(10);
    Score score10 = objective.getScore(ChatColor.BOLD + "" + Basic.minutes + "m " + Basic.seconds + "s"); //Get a fake offline player
    score10.setScore(9);
    Score score = objective.getScore(ChatColor.AQUA + "Kills:"); //Get a fake offline player
    score.setScore(8);
    Score score5 = objective.getScore(ChatColor.BOLD + "" + Basic.kills.get(p.getUniqueId()) + " "); //Get a fake offline player
    score5.setScore(7);
    Score score8 = objective.getScore(ChatColor.GOLD + "Deaths:");
    score8.setScore(6);
    Score score9 = objective.getScore(ChatColor.BOLD + "" + Basic.deaths.get(p.getUniqueId()) + " ");
    score9.setScore(5);
    return board;
}
项目:gFeatures    文件:Lobby.java   
public Scoreboard Initialize(Player p) throws IllegalStateException, IllegalArgumentException{
    ScoreboardManager manager = Bukkit.getScoreboardManager();
    Scoreboard board = manager.getNewScoreboard();
    Objective objective = board.registerNewObjective("test", "dummy");
    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    objective.setDisplayName(ChatColor.GOLD + "" + ChatColor.BOLD + "     _Esti" + ChatColor.DARK_AQUA + "" + ChatColor.BOLD +"Net_     ");
    Score score2 = objective.getScore(ChatColor.DARK_BLUE + "Online:"); //Get a fake offline player
    score2.setScore(4);
    Score score3 = objective.getScore(ChatColor.BOLD + "" + Integer.toString(Bukkit.getServer().getOnlinePlayers().size())); //Get a fake offline player
    score3.setScore(3);
    Score score = objective.getScore(ChatColor.AQUA + "Time before game starts:"); //Get a fake offline player
    score.setScore(2);
    Score score5 = objective.getScore(ChatColor.BOLD + "" + Basic.countdown + " "); //Get a fake offline player
    score5.setScore(1);
    return board;
}
项目:gFeatures    文件:Lobby.java   
public Scoreboard Initialize(Player p) throws IllegalStateException, IllegalArgumentException{
    ScoreboardManager manager = Bukkit.getScoreboardManager();
    Scoreboard board = manager.getNewScoreboard();
    Objective objective = board.registerNewObjective("test", "dummy");
    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    objective.setDisplayName(ChatColor.GOLD + "" + ChatColor.BOLD + "     _Esti" + ChatColor.DARK_AQUA + "" + ChatColor.BOLD +"Net_     ");
    Score score2 = objective.getScore(ChatColor.DARK_BLUE + "Online:"); //Get a fake offline player
    score2.setScore(4);
    Score score3 = objective.getScore(ChatColor.BOLD + "" + Integer.toString(Bukkit.getServer().getOnlinePlayers().size())); //Get a fake offline player
    score3.setScore(3);
    Score score = objective.getScore(ChatColor.AQUA + "Time before game starts:"); //Get a fake offline player
    score.setScore(2);
    Score score5 = objective.getScore(ChatColor.BOLD + "" + Basic.countdown + " "); //Get a fake offline player
    score5.setScore(1);
    return board;
}
项目:COD-Warfare    文件:Main.java   
public static void setGameBoard(final Player p){
 if (GameScoreboard.get(p.getName()) == null) {
  createGameBoard(p);
 }

 p.setScoreboard(GameScoreboard.get(p.getName()));

 GameKillsScore.get(p.getName()).setScore(0);
 GameDeathsScore.get(p.getName()).setScore(0);
 GameKillStreakScore.get(p.getName()).setScore(0);

 Score level = GameLevelScore.get(p.getName());
 level.setScore(LobbyLevelScore.get(p.getName()).getScore());

 Score credits = GameCreditsScore.get(p.getName());
 credits.setScore(LobbyCreditsScore.get(p.getName()).getScore());
}
项目:GameDispenser    文件:GameBase.java   
/** 
 * Counts players for scoreboard. Override to count differently. 
 */
protected void updatePlayerBoard() {
    if (playerTagScore > 0) {
        Score score = objective.getScore(ChatColor
                .translateAlternateColorCodes('&', "&6&lPlayers"));
        if (score.getScore() != playerTagScore)
            score.setScore(playerTagScore);
    }

    if (playerCounterScore > 0) {
        board.resetScores(lastPlayerCount + "");
        lastPlayerCount = getPlayers().length;
        objective.getScore(lastPlayerCount + "").setScore(
                playerCounterScore);
    }
}
项目:civcraft    文件:Arena.java   
public void decrementTimer() {
    if (timeleft <= 0) {
        if (!ended) {
            CivMessage.sendArena(this, "Time is up! Nobody Wins!");
            ArenaManager.declareDraw(this);
            ended = true;
        }
    } else {
        this.timeleft--;

        for (ArenaTeam team : this.teams.values()) {    
            Objective obj = objectives.get(team.getName()+";score");
            Score score = obj.getScore("Time Left");
            score.setScore(timeleft);
        }
    }
}
项目:Pugna    文件:Stats.java   
public void setBountyBoard(Player player, Player contractor, Reward reward)
{
    ScoreboardManager mang = Bukkit.getScoreboardManager();
    Scoreboard board = mang.getNewScoreboard();

    Objective objective = board.registerNewObjective("Stats", "dummy");

    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    objective.setDisplayName(ChatColor.BLUE +  "Bounty");

    Score bounty = objective.getScore(Bukkit.getOfflinePlayer("Bounty For You"));
    Score cont = objective.getScore(Bukkit.getOfflinePlayer("From: " + contractor.getPlayerListName())); //might be too long
    Score value = objective.getScore(Bukkit.getOfflinePlayer("Reward: " + reward.getItem()));

    bounty.setScore(1 + reward.getAmount());
    cont.setScore(1);
    value.setScore(reward.getAmount());

    player.setScoreboard(board);
    scoreTimer(player);
}
项目:Pugna    文件:Stats.java   
public void setPlayerBoard(Player player)
{
    ScoreboardManager mang = Bukkit.getScoreboardManager();
    Scoreboard board = mang.getNewScoreboard();

    Objective objective = board.registerNewObjective("Stats", "dummy");

    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    objective.setDisplayName(ChatColor.BLUE +  "Your Stats");

    Score score = objective.getScore(Bukkit.getOfflinePlayer("Score: "));
    Score kills = objective.getScore(Bukkit.getOfflinePlayer("Kills: " ));
    Score deaths = objective.getScore(Bukkit.getOfflinePlayer("Deaths: " ));
    Score teamRank = objective.getScore(Bukkit.getOfflinePlayer("Team Rank: "));

    PugnaPlayer play = pg.track.getPlayerData(player);
    PugnaScore values = play.getScore();

    score.setScore(values.getTotalScore());
    kills.setScore(values.getKills());
    deaths.setScore(values.getDeaths());

    player.setScoreboard(board);
    scoreTimer(player);
}
项目:AdminBar    文件:UpdateScoreboard.java   
@Override
public void run() {
    Objective adminbar = AdminBar.adminbar;
    Score tps = adminbar.getScore(Bukkit.getServer().getOfflinePlayer(ChatColor.GREEN + "Server TPS"));
    Score players = adminbar.getScore(Bukkit.getServer().getOfflinePlayer(ChatColor.GREEN + "Online Players"));
    Score staff = adminbar.getScore(Bukkit.getServer().getOfflinePlayer(ChatColor.GREEN + "Online Staff"));
    Score ram = adminbar.getScore(Bukkit.getServer().getOfflinePlayer(ChatColor.GREEN + "Used RAM (MB)"));
    Score ramPercent = adminbar.getScore(Bukkit.getServer().getOfflinePlayer(ChatColor.GREEN + "Used RAM (%)"));
    if (lastrun != -1) {
        tps.setScore(AdminBar.getTPS(lastrun));
    }
    lastrun = System.currentTimeMillis();
    players.setScore(AdminBar.getOnline());
    staff.setScore(AdminBar.getOnlineStaff());
    ram.setScore(AdminBar.getUsedRAM());
    ramPercent.setScore(AdminBar.getRAMPercent());
}
项目:PvZ    文件:PvZPreBoard.java   
public void update() {
    board.resetScores(lastPlayersNeeded + "");
    board.resetScores(lastStartingIn + "");

    if (playersUntilStart - (game.getPlants().getMembers().size() + game.getZombies().getMembers().size()) < 0)
        playersNeeded = 0;
    else
        playersNeeded = playersUntilStart - (game.getPlants().getMembers().size() + game.getZombies().getMembers().size());
    startingIn = game.getTimeUntilStart();
    lastPlayersNeeded = playersNeeded;
    lastStartingIn = startingIn;


    Score time = objective.getScore(ChatColor.translateAlternateColorCodes('&', "&lPlayers Needed"));
    time.setScore(4);
    Score intTime = objective.getScore(playersNeeded + "");
    intTime.setScore(3);
    Score endpoints = objective.getScore(ChatColor.translateAlternateColorCodes('&', "&lStarting In"));
    endpoints.setScore(2);
    Score numEnds = objective.getScore(startingIn + "");
    numEnds.setScore(1);
}
项目:PvZ    文件:PvZBoard.java   
public void update() {
    board.resetScores((game.getTimeLeft() + 1) + " seconds");
    int rowsRemaining = 0;
    for (int i = 0; i < game.getRows().size(); i++) {
        if (!game.getRows().get(i).isEndpointTaken())
            rowsRemaining++;
    }

    board.resetScores("" + (rowsRemaining + 1));

    Score time = objective.getScore(ChatColor.translateAlternateColorCodes('&', "&lTime Remaining"));
    time.setScore(4);
    Score intTime = objective.getScore(game.getTimeLeft() + " seconds");
    intTime.setScore(3);
    Score endpoints = objective.getScore(ChatColor.translateAlternateColorCodes('&', "&lRows Remaining"));
    endpoints.setScore(2);
    Score numEnds = objective.getScore("" + rowsRemaining);
    numEnds.setScore(1);
}
项目:MineKart    文件:ScoreboardManager.java   
/**
 * Set the jockeys standing on the scoreboard
 * 
 * @param jockey The jockey to set
 * @param standing The standing of the jockey
 */
public void setJockyStanding(Jockey jockey, int standing) {

    final int maxPlayers = this.race.getJockeys().size() + 1;

    Score score = this.sidebarObjective.getScore(jockey.getPlayer());
    if (score != null) {
        score.setScore(maxPlayers - standing);
    }

    final String name = jockey.getMount() != null ? jockey.getMount().getName() : jockey.getPlayer().getName();
    Team team = this.scoreboard.getTeam(name);
    if (team != null) {
        team.setSuffix(" [" + RaceHelper.ordinalNo(standing) + "]");
    }

}
项目:Uranium    文件:CraftScore.java   
public int getScore() throws IllegalStateException {
    net.minecraft.scoreboard.Scoreboard board = objective.checkState().board;

    if (board.getObjectiveNames().contains(entry)) { // Lazy
        Map<String, net.minecraft.scoreboard.Score> scores = board.func_96510_d(entry);
        net.minecraft.scoreboard.Score score = scores.get(objective.getHandle());
        if (score != null) { // Lazy
            return score.getScorePoints();
        }
    }

    return 0; // Lazy
}
项目:Uranium    文件:CraftScoreboard.java   
public ImmutableSet<Score> getScores(OfflinePlayer player) throws IllegalArgumentException {
    Validate.notNull(player, "OfflinePlayer cannot be null");

    ImmutableSet.Builder<Score> scores = ImmutableSet.builder();
    for (CraftObjective objective : objectives.values()) {
        scores.add(objective.getScore(player));
    }
    return scores.build();
}
项目:Uranium    文件:CraftScoreboard.java   
public ImmutableSet<Score> getScores(String entry) throws IllegalArgumentException {
    Validate.notNull(entry, "Entry cannot be null");

    ImmutableSet.Builder<Score> scores = ImmutableSet.builder();
    for (CraftObjective objective : objectives.values()) {
        scores.add(objective.getScore(entry));
    }
    return scores.build();
}
项目:KingdomFactions    文件:ScoreBoard.java   
public void editLine(int line, String newInput) {

        board.resetScores(lineId.get(line));
        Score score = board.getObjective(DisplaySlot.SIDEBAR).getScore(newInput);
        score.setScore(line);
        lineId.put(line, newInput);
    }
项目:mczone    文件:Arena.java   
public void setScore(String key, int value) {
    Score score = sidebar.getScore(Bukkit.getOfflinePlayer(Chat.colors(key)));
    score.setScore(value);

    score = specSidebar.getScore(Bukkit.getOfflinePlayer(Chat.colors(key)));
    score.setScore(value);
}
项目:skLib    文件:BetaScroller.java   
public BetaScroller(Player player){
    this.player = player;
    this.scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();

    this.test = scoreboard.registerNewObjective("test", "dummy");
    this.test.setDisplayName(ChatColor.DARK_RED + "" + ChatColor.BOLD + "TEST");
    this.test.setDisplaySlot(DisplaySlot.SIDEBAR);
    Score score = test.getScore("hi");
    score.setScore(7);
    player.getPlayer().setScoreboard(scoreboard);
}
项目:VanillaPlus    文件:StatVanilla.java   
public void update(VPPlayer player){
    Player p = player.getPlayer();
    if(p == null) p = Bukkit.getPlayer(player.getUUID());
    if(p == null) return;
    @SuppressWarnings("deprecation")
    Score score = objective.getScore(p);
    if(score != null){
        increase(player, score.getScore());
        score.setScore(0);
    }
}
项目:BendingExp    文件:BendingScoreboard.java   
public void updateScoreboard() {
    Score score;
    Player p = getOwner();
    BendingPlayer bp = BendingPlayer.getBendingPlayer(p);


    if(p == null || bp == null)
        return;

    clearBoard();

    if(bp.getAbilities().size() == 0)
        return;

    for(int i=9; i > 0; i--) {
        String ability = bp.getAbilities().get(i);
        if(ability == null || ability.equals("")) { //if empty slot
            continue;
        }
        else if(bp.isOnCooldown(ability)) { // if ability is on cooldown
            score = objective.getScore(CoreAbility.getAbility(ability).getElement().getColor()+""+ChatColor.STRIKETHROUGH+ability);
        }
        else { //if ability is available
            score = objective.getScore(CoreAbility.getAbility(ability).getElement().getColor()+ability);
        }
        score.setScore(i*-1);
    }

}
项目:MundoSK    文件:SkinManager.java   
public static void setNameTag(Player player, String nameTag) {
    if (nameTag != null && nameTag.length() > 16) {
        nameTag = nameTag.substring(0, 16); //Nametags can only be up to 16 chars in length
    }
    Logging.debug(SkinManager.class, "Setting nametag of " + player.getName() + " to " + nameTag);
    String oldNameTag = getNameTag(player);
    if (nameTag == null) {
        nameTag = player.getName();
    }
    Team team = player.getScoreboard() != null ? player.getScoreboard().getEntryTeam(player.getName()) : null;
    if (team != null) {
        team.removeEntry(player.getName());
        Scheduling.syncDelay(1, () -> team.addEntry(player.getName()));
    }
    Objective objective = player.getScoreboard() != null ? player.getScoreboard().getObjective(DisplaySlot.BELOW_NAME) : null;
    Score score = null;
    int actualScore = 0;
    if (objective != null) {
        score = objective.getScore(player.getName());
        actualScore = score.getScore();
        score.setScore(0);
    }
    nameTags.put(player, nameTag);
    refreshPlayer(player);
    updateTablistName(player);
    if (objective != null) {
        score.setScore(actualScore);
    }
    nameTags.forEach((nameTagOwner, s) -> {
        if (s.equals(oldNameTag)) {
            Team team1 = nameTagOwner.getScoreboard() != null ? nameTagOwner.getScoreboard().getEntryTeam(nameTagOwner.getName()) : null;
            if (team1 != null) {
                team1.removeEntry(nameTagOwner.getName());
                Scheduling.syncDelay(1, () -> team1.addEntry(nameTagOwner.getName()));
            }

        }
    });
}
项目:BiteSkywars    文件:Arena.java   
public void getScoreboard(Player p){
    this.o = Bukkit.getScoreboardManager().getNewScoreboard().registerNewObjective(this.name, "dummy");
    o.setDisplayName(Skywars.lang.get("scoreboard.name").replaceAll("%map", this.name).replaceAll("%name", p.getName()));
    o.setDisplaySlot(DisplaySlot.SIDEBAR);
    Score sc = null;
    int i = 15;
    for(String c : Skywars.lang.getConfig().getStringList("scoreboard.lines")){
        sc = o.getScore(ChatColor.translateAlternateColorCodes('&',c.replaceAll("%players", ""+ingame.size()).replaceAll("%map", name).replaceAll("%min", ""+min).replaceAll("%max", ""+max).replaceAll("%name", p.getName())));
        sc.setScore(i);
        i--;
    }
    p.setScoreboard(this.o.getScoreboard());
}
项目:AthenaGM    文件:ScoreboardModule.java   
/**
 * Update sidebar score box when points are scored
 */
@EventHandler
public void onPlayerScorePointEvent(PlayerScorePointEvent event) {
    Objective objective = boards.get(event.getTeam().getMatch()).getObjective("matchscore");
    Score score = objective.getScore(event.getTeam().getChatColor() + event.getTeam().getName());
    score.setScore(score.getScore() + event.getPointsScored());
}
项目:AthenaGM    文件:ScoreboardModule.java   
/**
 * Update the scoreboard once every second, to account for team.incrementPoints()
 */
private void syncScores(Match match) {
    Score score;
    Objective objective = boards.get(match).getObjective("matchscore");
    for (Team team : match.getTeams().values()) {
        if (!team.isSpectator()) {
            score = objective.getScore(team.getChatColor() + team.getName());
            score.setScore(team.getPoints());
        }
    }
}
项目:ThermosRebased    文件:CraftScore.java   
public int getScore() throws IllegalStateException {
    net.minecraft.scoreboard.Scoreboard board = objective.checkState().board;

    if (board.getObjectiveNames().contains(entry)) { // Lazy
        Map<String, net.minecraft.scoreboard.Score> scores = board.func_96510_d(entry);
        net.minecraft.scoreboard.Score score = scores.get(objective.getHandle());
        if (score != null) { // Lazy
            return score.getScorePoints();
        }
    }

    return 0; // Lazy
}
项目:ThermosRebased    文件:CraftScoreboard.java   
public ImmutableSet<Score> getScores(OfflinePlayer player) throws IllegalArgumentException {
    Validate.notNull(player, "OfflinePlayer cannot be null");

    ImmutableSet.Builder<Score> scores = ImmutableSet.builder();
    for (CraftObjective objective : objectives.values()) {
        scores.add(objective.getScore(player));
    }
    return scores.build();
}
项目:ThermosRebased    文件:CraftScoreboard.java   
public ImmutableSet<Score> getScores(String entry) throws IllegalArgumentException {
    Validate.notNull(entry, "Entry cannot be null");

    ImmutableSet.Builder<Score> scores = ImmutableSet.builder();
    for (CraftObjective objective : objectives.values()) {
        scores.add(objective.getScore(entry));
    }
    return scores.build();
}
项目:Cardinal    文件:ScoreboardEntry.java   
/**
 * This will replace the entry, take into account that this will make the scoreboard flicker.
 *
 * <p>IMPORTANT the new entry passed shouldn't be used anywhere else, or it will create problems.
 * @param newEntry The new entry.
 */
public void setEntry(String newEntry) {
  if (!newEntry.equals(getEntry())) {
    Score old = score;
    objective.getScoreboard().resetScores(old.getEntry());
    team.removeEntry(old.getEntry());
    team.addEntry(newEntry);
    this.score = objective.getScore(newEntry);
    setScore(old.getScore(), true);
    if (!isShown()) {
      shown = true;
      hide();
    }
  }
}
项目:Cardinal    文件:ScoreboardEntry.java   
/**
 * Shows this scoreboard entry again, after being hid by running hide().
 */
public void show() {
  if (!isShown()) {
    Score old = score;
    this.score = objective.getScore(old.getEntry());
    setScore(old.getScore(), true);
    shown = true;
  }
}
项目:Breakpoint    文件:CTFGame.java   
public void updateProgressObjectiveScores(Objective progressObj)
{
    for(int i = 0; i < 2; i++)
    {
        Score score = progressObj.getScore(Bukkit.getOfflinePlayer(scoreHeaderNames[i]));
        score.setScore(flm.getScore()[i]);
    }
}
项目:Breakpoint    文件:DMGame.java   
public void updateProgressObjectiveScores(Objective progressObj)
{
    for(BPPlayer bpPlayer : getPlayers())
    {
        int killsThisRound = getPoints(bpPlayer);
        OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(bpPlayer.getTag());
        Score score = progressObj.getScore(offlinePlayer);

        score.setScore(killsThisRound);
    }
}