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


Java Scoreboard.getObjective方法代碼示例

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


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

示例1: getOrCreateObjective

import org.bukkit.scoreboard.Scoreboard; //導入方法依賴的package包/類
private static Objective getOrCreateObjective(Scoreboard scoreboard, String name, String criteria) {
    Objective obj = scoreboard.getObjective(name);
    if(obj == null) {
        obj = scoreboard.registerNewObjective(name, criteria);
    }
    return obj;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:8,代碼來源:RaindropsListener.java

示例2: setRaindropsCount

import org.bukkit.scoreboard.Scoreboard; //導入方法依賴的package包/類
private void setRaindropsCount(Player player, int count) {
    if(player == null) return;

    final Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
    Objective objective = scoreboard.getObjective(player.getName());

    Integer oldCount = raindrops.get(player);
    if(oldCount != null) {
        Utils.removeScore(player, String.format("%,d", oldCount));
    }
    Utils.addScore(player, objective, String.format("%,d", count), 1);

    raindrops.put(player, count);

    Utils.giveGhastTear(player, count);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:17,代碼來源:RaindropsListener.java

示例3: check

import org.bukkit.scoreboard.Scoreboard; //導入方法依賴的package包/類
public boolean check(Event e) {
	Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
	if (scoreboard != null) {
		board = scoreboard.getSingle(e);
	}
	if (board.getObjective(obj.getSingle(e)) != null) {
		if (boo == true) {
			return true;
		} else {
			return false;
		}
	} else {
		if (boo == false) {
			return true;
		} else {
			return false;
		}
	}
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:20,代碼來源:CondObjectiveExists.java

示例4: get

import org.bukkit.scoreboard.Scoreboard; //導入方法依賴的package包/類
@Override
@Nullable
protected Objective[] get(Event e) {
	Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
	if (scoreboard != null) {
		board = scoreboard.getSingle(e);
	}
	if (obj.getSingle(e).equals("BELOW_NAME")||obj.getSingle(e).equals("PLAYER_LIST")||obj.getSingle(e).equals("SIDEBAR")) {
		DisplaySlot slot = DisplaySlot.valueOf(obj.getSingle(e).replace("\"", "").trim().replace(" ", "_").toUpperCase());
		try {
			slot = DisplaySlot.valueOf(slot.toString().replace("\"", "").trim().replace(" ", "_").toUpperCase());
		} catch (IllegalArgumentException t) {
			return null;
		}
		return new Objective[]{board.getObjective(slot)};
	} else {
		return new Objective[]{board.getObjective(obj.getSingle(e))};
	}
}
 
開發者ID:TheLimeGlass,項目名稱:Skellett,代碼行數:20,代碼來源:ExprGetObjective.java

示例5: ScoreboardBuilder

import org.bukkit.scoreboard.Scoreboard; //導入方法依賴的package包/類
/**
 * Create an instance of the scoreboard builder
 * 
 * @param objective The objective name to use
 * @param displayName The text to appear above all scores on the sidebar
 */
public ScoreboardBuilder(String objective, String displayName) {
	Scoreboard s = Bukkit.getScoreboardManager().getNewScoreboard();
	s.registerNewObjective(objective, "dummy");
	Objective o = s.getObjective(objective);
	o.setDisplaySlot(DisplaySlot.SIDEBAR);
	o.setDisplayName(ChatColor.translateAlternateColorCodes('&', displayName));
	advanced = new ScoreboardHelper(s, o);
}
 
開發者ID:DonkeyCore,項目名稱:MinigameManager,代碼行數:15,代碼來源:ScoreboardBuilder.java

示例6: setscoresb

import org.bukkit.scoreboard.Scoreboard; //導入方法依賴的package包/類
public static void setscoresb(Player p, int slot, String value) {
	Scoreboard sb = p.getScoreboard();
	Objective ob = sb.getObjective(DisplaySlot.SIDEBAR);
	Score score = ob.getScore(value);
	score.setScore(slot);
}
 
開發者ID:WheezyGold7931,項目名稱:skLib,代碼行數:7,代碼來源:SbManager.java

示例7: unrankedSidebarDisplay

import org.bukkit.scoreboard.Scoreboard; //導入方法依賴的package包/類
public static boolean unrankedSidebarDisplay(Collection<Player> players, String[] elements, Scoreboard board)
{
	try
	{
		String objName = "COLLAB-SB-WINTER";

		if(board == null)
			board = Bukkit.getScoreboardManager().getNewScoreboard();

		elements = cutUnranked(elements);

		for(Player player : players)
			if(player.getScoreboard() != board)
				player.setScoreboard(board);

		if(board.getObjective(objName) == null)
		{
			board.registerNewObjective(objName, "dummy");
			board.getObjective(objName).setDisplaySlot(DisplaySlot.SIDEBAR);
		}


		board.getObjective(DisplaySlot.SIDEBAR).setDisplayName(elements[0]);

		for(int i = 1; i < elements.length; i++)
			if(elements[i] != null && board.getObjective(DisplaySlot.SIDEBAR).getScore(elements[i]).getScore() != 16 - i)
			{
				board.getObjective(DisplaySlot.SIDEBAR).getScore(elements[i]).setScore(16 - i);
				for(String string : board.getEntries())
					if(board.getObjective(objName).getScore(string).getScore() == 16 - i)
						if(!string.equals(elements[i]))
							board.resetScores(string);

			}

		for(String entry : board.getEntries())
		{
			boolean toErase = true;
			for(String element : elements)
			{
				if(element != null && element.equals(entry) && board.getObjective(objName).getScore(entry).getScore() == 16 - Arrays.asList(elements).indexOf(element))
				{
					toErase = false;
					break;
				}
			}

			if(toErase)
				board.resetScores(entry);

		}

		return true;
	}
	catch(Exception e)
	{
		e.printStackTrace();
		return false;
	}
}
 
開發者ID:kncxstudio,項目名稱:BasicSurvivalPlus,代碼行數:61,代碼來源:ScoreboardUtil.java

示例8: unrankedSidebarDisplay

import org.bukkit.scoreboard.Scoreboard; //導入方法依賴的package包/類
public static boolean unrankedSidebarDisplay(Collection<Player> players, Scoreboard board, String... elements)
{
	try
	{
		String objName = "COLLAB-SB-WINTER";

		if(board == null)
			board = Bukkit.getScoreboardManager().getNewScoreboard();

		elements = cutUnranked(elements);

		for(Player player : players)
			if(player.getScoreboard() != board)
				player.setScoreboard(board);

		if(board.getObjective(objName) == null)
		{
			board.registerNewObjective(objName, "dummy");
			board.getObjective(objName).setDisplaySlot(DisplaySlot.SIDEBAR);
		}


		board.getObjective(DisplaySlot.SIDEBAR).setDisplayName(elements[0]);

		for(int i = 1; i < elements.length; i++)
			if(elements[i] != null && board.getObjective(DisplaySlot.SIDEBAR).getScore(elements[i]).getScore() != 16 - i)
			{
				board.getObjective(DisplaySlot.SIDEBAR).getScore(elements[i]).setScore(16 - i);
				for(String string : board.getEntries())
					if(board.getObjective(objName).getScore(string).getScore() == 16 - i)
						if(!string.equals(elements[i]))
							board.resetScores(string);

			}

		for(String entry : board.getEntries())
		{
			boolean toErase = true;
			for(String element : elements)
			{
				if(element != null && element.equals(entry) && board.getObjective(objName).getScore(entry).getScore() == 16 - Arrays.asList(elements).indexOf(element))
				{
					toErase = false;
					break;
				}
			}

			if(toErase)
				board.resetScores(entry);

		}

		return true;
	}
	catch(Exception e)
	{
		e.printStackTrace();
		return false;
	}
}
 
開發者ID:WinterAlexander,項目名稱:EasyScoreboards,代碼行數:61,代碼來源:ScoreboardUtil.java


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