當前位置: 首頁>>代碼示例>>Java>>正文


Java Objective.getScore方法代碼示例

本文整理匯總了Java中org.bukkit.scoreboard.Objective.getScore方法的典型用法代碼示例。如果您正苦於以下問題:Java Objective.getScore方法的具體用法?Java Objective.getScore怎麽用?Java Objective.getScore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.scoreboard.Objective的用法示例。


在下文中一共展示了Objective.getScore方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setLine

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:Shynixn,項目名稱:BlockBall,代碼行數:31,代碼來源:SimpleScoreboard.java

示例2: createSidebarTeamScoreObjective

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
/**
 * 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);
        }
    }

}
 
開發者ID:redwallhp,項目名稱:AthenaGM,代碼行數:20,代碼來源:ScoreboardModule.java

示例3: updateProgressObjectiveScore

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
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]);
		}
	}
}
 
開發者ID:Limeth,項目名稱:Breakpoint,代碼行數:22,代碼來源:CTFGame.java

示例4: createScoreboard

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
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);
}
 
開發者ID:grzegorz2047,項目名稱:ExtremeSurvival,代碼行數:18,代碼來源:ScoreboardManagement.java

示例5: Initialize

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
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;
}
 
開發者ID:EstiNet,項目名稱:gFeatures,代碼行數:25,代碼來源:GlidersScore.java

示例6: Initialize

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
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;
}
 
開發者ID:EstiNet,項目名稱:gFeatures,代碼行數:17,代碼來源:Lobby.java

示例7: decrementTimer

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
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);
		}
	}
}
 
開發者ID:netizen539,項目名稱:civcraft,代碼行數:18,代碼來源:Arena.java

示例8: setBountyBoard

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
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);
}
 
開發者ID:tritania,項目名稱:Pugna,代碼行數:22,代碼來源:Stats.java

示例9: setPlayerBoard

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
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);
}
 
開發者ID:tritania,項目名稱:Pugna,代碼行數:26,代碼來源:Stats.java

示例10: run

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
@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());
}
 
開發者ID:DeprecatedNether,項目名稱:AdminBar,代碼行數:18,代碼來源:UpdateScoreboard.java

示例11: setNameTag

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
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()));
            }

        }
    });
}
 
開發者ID:MundoSK,項目名稱:MundoSK,代碼行數:40,代碼來源:SkinManager.java

示例12: onPlayerScorePointEvent

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
/**
 * 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());
}
 
開發者ID:redwallhp,項目名稱:AthenaGM,代碼行數:10,代碼來源:ScoreboardModule.java

示例13: syncScores

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
/**
 * 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());
        }
    }
}
 
開發者ID:redwallhp,項目名稱:AthenaGM,代碼行數:14,代碼來源:ScoreboardModule.java

示例14: updateProgressObjectiveScores

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
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]);
	}
}
 
開發者ID:Limeth,項目名稱:Breakpoint,代碼行數:9,代碼來源:CTFGame.java

示例15: updateProgressObjectiveScores

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
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);
	}
}
 
開發者ID:Limeth,項目名稱:Breakpoint,代碼行數:12,代碼來源:DMGame.java


注:本文中的org.bukkit.scoreboard.Objective.getScore方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。