本文整理了Java中org.bukkit.Bukkit.getScoreboardManager()
方法的一些代码示例,展示了Bukkit.getScoreboardManager()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bukkit.getScoreboardManager()
方法的具体详情如下:
包路径:org.bukkit.Bukkit
类名称:Bukkit
方法名:getScoreboardManager
暂无
代码示例来源:origin: Bukkit/Bukkit
private List<String> getCurrentEntries() {
List<String> list = new ArrayList<String>();
for (String entry : Bukkit.getScoreboardManager().getMainScoreboard().getEntries()) {
list.add(entry);
}
Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
return list;
}
代码示例来源:origin: Bukkit/Bukkit
private List<String> getCurrentTeams() {
List<String> list = new ArrayList<String>();
for (Team team : Bukkit.getScoreboardManager().getMainScoreboard().getTeams()) {
list.add(team.getName());
}
Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
return list;
}
}
代码示例来源:origin: Bukkit/Bukkit
private List<String> getCurrentObjectives() {
List<String> list = new ArrayList<String>();
for (Objective objective : Bukkit.getScoreboardManager().getMainScoreboard().getObjectives()) {
list.add(objective.getName());
}
Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
return list;
}
代码示例来源:origin: Bukkit/Bukkit
final Scoreboard mainScoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
代码示例来源:origin: ProSavage/SavageFactions
public static boolean isSupportedByServer() {
return Bukkit.getScoreboardManager() != null;
}
代码示例来源:origin: garbagemule/MobArena
/**
* Create a new scoreboard for the given arena.
* @param arena an arena
*/
ScoreboardManager(Arena arena) {
this.arena = arena;
scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
scoreboards = new HashMap<>();
}
代码示例来源:origin: Bkm016/TabooLib
public SimpleScoreboard(String title) {
this.scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
this.title = ChatColor.translateAlternateColorCodes('&', title);
this.scores = new ConcurrentHashMap<>();
this.teams = Collections.synchronizedList(Lists.newArrayList());
this.removed = Lists.newArrayList();
this.updated = Collections.synchronizedSet(new HashSet<>());
}
代码示例来源:origin: SpigotMC/Spigot-API
private List<String> getCurrentEntries() {
List<String> list = new ArrayList<String>();
for (String entry : Bukkit.getScoreboardManager().getMainScoreboard().getEntries()) {
list.add(entry);
}
Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
return list;
}
代码示例来源:origin: SpigotMC/Spigot-API
private List<String> getCurrentTeams() {
List<String> list = new ArrayList<String>();
for (Team team : Bukkit.getScoreboardManager().getMainScoreboard().getTeams()) {
list.add(team.getName());
}
Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
return list;
}
}
代码示例来源:origin: SpigotMC/Spigot-API
private List<String> getCurrentObjectives() {
List<String> list = new ArrayList<String>();
for (Objective objective : Bukkit.getScoreboardManager().getMainScoreboard().getObjectives()) {
list.add(objective.getName());
}
Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
return list;
}
代码示例来源:origin: dzikoysk/WildSkript
public Scoreboard getScoreboard() {
if (scoreboard == null) {
this.scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
this.player.setScoreboard(scoreboard);
}
return scoreboard;
}
代码示例来源:origin: FunnyGuilds/FunnyGuilds
private void fill() {
int required = Bukkit.getMaxPlayers() * 2;
if (stack.size() < required) {
ScoreboardManager sm = Bukkit.getScoreboardManager();
if (sm == null) {
FunnyGuildsLogger.error("[ScoreboardStack] ScoreboardManager is null!");
return;
}
int loop = Bukkit.getMaxPlayers() * 2 - stack.size();
for (int i = 0; i < loop; i++) {
stack.push(sm.getNewScoreboard());
}
}
}
}
代码示例来源:origin: mcmonkeyprojects/Sentinel
@Override
public boolean isTarget(LivingEntity ent, String text) {
try {
if (text.startsWith("sbteam:") && ent instanceof Player) {
String sbteamName = text.substring("sbteam:".length());
Team t = Bukkit.getScoreboardManager().getMainScoreboard().getTeam(sbteamName);
if (t != null) {
if (t.hasEntry(((Player) ent).getName())) {
return true;
}
}
}
}
catch (Exception ex) {
ex.printStackTrace();
}
return false;
}
}
代码示例来源:origin: garbagemule/MobArena
/**
* Remove a player from the scoreboard by setting the player's scoreboard
* to the main server scoreboard.
* @param player a player
*/
void removePlayer(Player player) {
try {
Scoreboard scoreboard = scoreboards.remove(player);
if (scoreboard != null) {
player.setScoreboard(scoreboard);
} else {
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
}
} catch (IllegalStateException e) {
// Happens if the player is logging out, just swallow it
}
}
代码示例来源:origin: nsporillo/GlobalWarming
/**
* Get any scoreboard by world
* - Note: players should use their associated-world (not current-world)
*/
private Scoreboard getScoreboard(UUID worldId, boolean isCreateIfNotFound) {
Scoreboard scoreboard = null;
if (ClimateEngine.getInstance().isClimateEngineEnabled(worldId)) {
if (scoreboards.containsKey(worldId)) {
//Existing scoreboard:
scoreboard = scoreboards.get(worldId);
} else if (isCreateIfNotFound) {
//New scoreboard:
scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
scoreboards.put(worldId, scoreboard);
//Objective (scoreboard title / group):
Objective objective = scoreboard.registerNewObjective(
GLOBAL_WARMING,
"dummy",
"[TITLE]");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
}
}
return scoreboard;
}
代码示例来源:origin: Bkm016/TabooLib
public static Scoreboard getScoreboardComputeIfAbsent(Player player) {
Scoreboard scoreboard = player.getScoreboard();
if (scoreboard == null) {
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
}
return player.getScoreboard();
}
代码示例来源:origin: ProSavage/SavageFactions
private FScoreboard(FPlayer fplayer) {
this.fplayer = fplayer;
if (isSupportedByServer()) {
this.scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
this.bufferedObjective = new BufferedObjective(scoreboard);
fplayer.getPlayer().setScoreboard(scoreboard);
} else {
this.scoreboard = null;
this.bufferedObjective = null;
}
}
代码示例来源:origin: Co0sh/BetonQuest
@Override
public void run(String playerID) throws IllegalStateException, QuestRuntimeException {
Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
Objective obj = board.getObjective(objective);
if (obj == null) {
throw new QuestRuntimeException("Scoreboard objective " + objective + " does not exist!");
}
Score score = obj.getScore(PlayerConverter.getName(playerID));
if (multi) {
score.setScore((int) Math.floor(score.getScore() * count.getDouble(playerID)));
} else {
score.setScore((int) Math.floor(score.getScore() + count.getDouble(playerID)));
}
}
代码示例来源:origin: Co0sh/BetonQuest
@Override
public boolean check(String playerID) throws QuestRuntimeException {
Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
Objective obj = board.getObjective(objective);
if (obj == null) {
throw new QuestRuntimeException("Scoreboard objective " + objective + " does not exist!");
}
Score score = obj.getScore(PlayerConverter.getName(playerID));
return score.getScore() >= count.getInt(playerID);
}
代码示例来源:origin: dzikoysk/WildSkript
protected void execute(Event event) {
Player p = this.player.getSingle(event);
String s = this.tag.getSingle(event);
if (p == null || s == null) {
return;
}
if (s.length() > 16) {
Bukkit.getLogger().severe("String to edit tag name is too long! Max length is 16");
return;
}
Scoreboard sb = Bukkit.getScoreboardManager().getMainScoreboard();
Team team = sb.getPlayerTeam(p);
if (team == null) {
team = sb.getTeam(p.getName());
if (team == null) {
team = sb.registerNewTeam(p.getName());
}
team.addPlayer(p);
}
team.setPrefix(s);
p.setScoreboard(sb);
}
内容来源于网络,如有侵权,请联系作者删除!