当前位置: 首页>>代码示例>>Java>>正文


Java Scoreboard.resetScores方法代码示例

本文整理汇总了Java中org.bukkit.scoreboard.Scoreboard.resetScores方法的典型用法代码示例。如果您正苦于以下问题:Java Scoreboard.resetScores方法的具体用法?Java Scoreboard.resetScores怎么用?Java Scoreboard.resetScores使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.scoreboard.Scoreboard的用法示例。


在下文中一共展示了Scoreboard.resetScores方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.bukkit.scoreboard.Scoreboard; //导入方法依赖的package包/类
@Override
protected void execute(Event e) {
	Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
	if (scoreboard != null) {
		board = scoreboard.getSingle(e);
	}
	board.resetScores(entry.getSingle(e));
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:9,代码来源:EffResetEntryScores.java

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

示例3: 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.resetScores方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。