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


Java Score類代碼示例

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


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

示例1: setLine

import org.bukkit.scoreboard.Score; //導入依賴的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.Score; //導入依賴的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: updatePlayer

import org.bukkit.scoreboard.Score; //導入依賴的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

示例4: Spin

import org.bukkit.scoreboard.Score; //導入依賴的package包/類
@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);
}
 
開發者ID:FattyMieo,項目名稱:SurvivalPlus,代碼行數:26,代碼來源:Valkyrie.java

示例5: updateProgressObjectiveScore

import org.bukkit.scoreboard.Score; //導入依賴的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

示例6: create

import org.bukkit.scoreboard.Score; //導入依賴的package包/類
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());
}
 
開發者ID:letsgo00,項目名稱:CubeKrowd-Icerunner,代碼行數:22,代碼來源:Scoreboardmanager.java

示例7: createScoreboard

import org.bukkit.scoreboard.Score; //導入依賴的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

示例8: setScoreboard

import org.bukkit.scoreboard.Score; //導入依賴的package包/類
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);
    }
}
 
開發者ID:ddonofrio,項目名稱:libelula,代碼行數:25,代碼來源:ScoreManager.java

示例9: Initialize

import org.bukkit.scoreboard.Score; //導入依賴的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

示例10: Initialize

import org.bukkit.scoreboard.Score; //導入依賴的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

示例11: setGameBoard

import org.bukkit.scoreboard.Score; //導入依賴的package包/類
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());
}
 
開發者ID:frostythedev,項目名稱:COD-Warfare,代碼行數:18,代碼來源:Main.java

示例12: updatePlayerBoard

import org.bukkit.scoreboard.Score; //導入依賴的package包/類
/** 
 * 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);
	}
}
 
開發者ID:Lactem,項目名稱:GameDispenser,代碼行數:19,代碼來源:GameBase.java

示例13: decrementTimer

import org.bukkit.scoreboard.Score; //導入依賴的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

示例14: setBountyBoard

import org.bukkit.scoreboard.Score; //導入依賴的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

示例15: setPlayerBoard

import org.bukkit.scoreboard.Score; //導入依賴的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


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