本文整理匯總了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;
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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]);
}
}
}
示例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());
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
示例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());
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
示例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);
}