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