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


Java Objective.setDisplayName方法代碼示例

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


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

示例1: enableScoreboard

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
@Override
public void enableScoreboard() {
       final Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
       final Objective obj = board.registerNewObjective("Spigotboard", "dummy");
       
       obj.setDisplaySlot(DisplaySlot.SIDEBAR);
       obj.setDisplayName(ChatColor.translateAlternateColorCodes('&', Main.instance.getConfig().getString("title")));

       new BukkitRunnable() {
           @Override
           public void run() {
               for(Player p : Bukkit.getOnlinePlayers()) {
               	int count = Main.instance.getConfig().getList("text").size();
               	
               	PlaceholderUtils placeholders = new PlaceholderUtils(p);
                   for(Object text : Main.instance.getConfig().getList("text")){
                   	obj.getScore(ChatColor.translateAlternateColorCodes('&', placeholders.replace(text.toString()))).setScore(count);
                   	count--;
                   }
                   p.setScoreboard(board);
               }
           }
       }.runTaskTimer(Main.instance, 0, 20);
}
 
開發者ID:TheIndra55,項目名稱:SpigotBoard,代碼行數:25,代碼來源:SBScoreboard.java

示例2: displayScoreboard

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void displayScoreboard(final PlayerJoinEvent event) {
    final Player player = event.getPlayer();
    final User user = userStore.getUser(player);
    final PlayerId playerId = tc.oc.api.bukkit.users.Users.playerId(player);
    final Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
    final Objective objective = getOrCreateObjective(scoreboard, player.getName(), "dummy");
    final String raindropsName = ChatColor.AQUA + "Raindrops";

    objective.setDisplayName(renderer.renderLegacy(generalFormatter.brandName(), event.getPlayer()));

    objective.getScore(raindropsName).setScore(2);
    Utils.displayScoreboard(player, objective);
    setRaindropsCount(player, user.raindrops());
    GizmoUtils.setGizmo(player, Gizmos.emptyGizmo, true);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:17,代碼來源:RaindropsListener.java

示例3: 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

示例4: refreshScoreboard

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
private void refreshScoreboard(Player player)
{
    if (getThirstString(player).length() > 40)
    {
        Thirst.getInstance().printPluginError("Error occurred while displaying scoreboard.", "The string "+getThirstString(player)+" is longer than 40 characters." +
                                                                                                     "\nYou must have a thirst message under 40 characters to use the SCOREBOARD displaytype." +
                                                                                                     "\n " +
                                                                                                     "\nNOTE: This message will be displayed every time Thirst tries to update someones thirst (A lot!)");
        return;
    }

    Scoreboard board = manager.getNewScoreboard();
    Objective obj = board.registerNewObjective(player.getName().toUpperCase(), "dummy");

    obj.setDisplaySlot(DisplaySlot.SIDEBAR);
    obj.setDisplayName(ChatColor.translateAlternateColorCodes('&', Thirst.getInstance().getYAMLConfig().scoreboardName.replace("%player%", player.getName())));
    obj.getScore(getThirstString(player)).setScore(-1);

    player.setScoreboard(board);
}
 
開發者ID:GamerKing195,項目名稱:Thirst,代碼行數:21,代碼來源:ThirstManager.java

示例5: createPlayerHealthObjective

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
/**
 * Show the player's health under their nameplate
 */
private void createPlayerHealthObjective(Match match) {

    Scoreboard board = boards.get(match);
    Objective objective = board.registerNewObjective("playerhealth", "health");
    objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
    objective.setDisplayName(ChatColor.RED + "❤");

    //Force health objective to update health readout
    for (Team team : match.getTeams().values()) {
        for (Player player : team.getPlayers()) {
            player.setHealth(player.getHealth());
        }
    }

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

示例6: 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

示例7: ScoreHelper

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
private ScoreHelper(Player player, boolean healthName, boolean healthTab) {
	this.player = player;
	scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
	sidebar = scoreboard.registerNewObjective("sidebar", "dummy");
	sidebar.setDisplaySlot(DisplaySlot.SIDEBAR);
	player.setScoreboard(scoreboard);
	// Create Teams
	for(int i=1; i<=15; i++) {
		Team team = scoreboard.registerNewTeam("SLOT_" + i);
		team.addEntry(genEntry(i));
	}

	if(healthName) {
		Objective hName = scoreboard.registerNewObjective("hname", "health");
		hName.setDisplaySlot(DisplaySlot.BELOW_NAME);
		hName.setDisplayName(ChatColor.RED + "❤");
	}

	if(healthTab) {
		Objective hTab = scoreboard.registerNewObjective("htab", "health");
		hTab.setDisplaySlot(DisplaySlot.PLAYER_LIST);
	}

	players.put(player.getUniqueId(), this);
}
 
開發者ID:crisdev333,項目名稱:ProScoreboard,代碼行數:26,代碼來源:ScoreHelper.java

示例8: 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

示例9: setScoreboard

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

示例10: 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

示例11: 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

示例12: execute

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
@Override
protected void execute(Event evt) {

  for (Player p : players.getArray(evt)) {
    if (!(p.isOnline())) {
      Skript.error("The player is not online!");
    } else {
      if (p.getScoreboard().getObjective("sidebarHold") != null) {
        Objective objective = p.getScoreboard().getObjective(DisplaySlot.SIDEBAR);
        objective.setDisplayName(name.getSingle(evt).replace("\"", ""));
      } else {
        Objective objectiveh = p.getScoreboard().registerNewObjective("sidebarHold", "dummy");
        objectiveh.setDisplaySlot(DisplaySlot.SIDEBAR);
        objectiveh.setDisplayName(name.getSingle(evt).replace("\"", ""));
      }
    }
  }


}
 
開發者ID:eyesniper2,項目名稱:skRayFall,代碼行數:21,代碼來源:EffNameOfScore.java

示例13: 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

示例14: 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

示例15: getPowerLevelObjective

import org.bukkit.scoreboard.Objective; //導入方法依賴的package包/類
/**
 * Gets or creates the power level objective on the main scoreboard.
 * <p/>
 * If power levels are disabled, the objective is deleted and null is
 * returned.
 *
 * @return the main scoreboard objective, or null if disabled
 */
public static Objective getPowerLevelObjective() {
    if (!Config.getInstance().getPowerLevelTagsEnabled()) {
        Objective objective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);

        if (objective != null) {
            objective.unregister();
            mcMMO.p.debug("Removed leftover scoreboard objects from Power Level Tags.");
        }

        return null;
    }

    Objective powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);

    if (powerObjective == null) {
        powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().registerNewObjective(POWER_OBJECTIVE, "dummy");
        powerObjective.setDisplayName(TAG_POWER_LEVEL);
        powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
    }

    return powerObjective;
}
 
開發者ID:Pershonkey,項目名稱:McMMOPlus,代碼行數:31,代碼來源:ScoreboardManager.java


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