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