use of org.bukkit.scoreboard.Objective in project GameCore by Warvale.
the class LobbyScoreboard method updatePlayerCount.
public void updatePlayerCount() {
for (Player online : Bukkit.getOnlinePlayers()) {
Objective objective = getScoreboards().get(online.getUniqueId()).getObjective("lobby");
Team playerCount = getScoreboards().get(online.getUniqueId()).getTeam("LobbyCount");
if (objective != null && playerCount != null) {
playerCount.setSuffix(" §7" + Bukkit.getOnlinePlayers().size() + "/" + Game.getInstance().getMaxPlayer());
objective.getScore("§8» §cPlayers:").setScore(11);
objective.getScore(" ").setScore(10);
}
}
}
use of org.bukkit.scoreboard.Objective in project GameCore by Warvale.
the class LobbyScoreboard method newScoreboard.
public void newScoreboard(Player p, String display) {
//add the user to the scoreboard
if (!getScoreboards().containsKey(p.getUniqueId())) {
addScoreboard(p, display);
}
Objective objective = getScoreboards().get(p.getUniqueId()).getObjective("lobby");
if (objective != null) {
objective.setDisplayName(ChatColor.DARK_GRAY + "» " + display + ChatColor.DARK_GRAY + " «");
}
//update the scoreboard
updateTime();
updatePlayerCount();
p.setScoreboard(getScoreboards().get(p.getUniqueId()));
}
use of org.bukkit.scoreboard.Objective in project GameCore by Warvale.
the class LobbyScoreboard method updateTime.
public void updateTime() {
for (Player online : Bukkit.getOnlinePlayers()) {
Objective objective = getScoreboards().get(online.getUniqueId()).getObjective("lobby");
Team time = getScoreboards().get(online.getUniqueId()).getTeam("LobbyTime");
if (objective != null && time != null) {
objective.getScore(" ").setScore(14);
//objective.getScore("§8» §cTime:").setScore(7);
Format date = new SimpleDateFormat("HH:mm:ss 'UTC'", Locale.US);
String dateStr = date.format(new Date());
time.setSuffix(" §7" + dateStr);
objective.getScore("§8» §cTime:").setScore(13);
objective.getScore(" ").setScore(12);
}
}
}
use of org.bukkit.scoreboard.Objective in project GameCore by Warvale.
the class LobbyScoreboard method addScoreboard.
public void addScoreboard(Player player) {
Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
Objective objective = scoreboard.registerNewObjective("lobby", "dummy");
objective.setDisplayName(ChatColor.DARK_GRAY + "» " + ChatColor.GREEN + "Waiting For Players..." + ChatColor.DARK_GRAY + " «");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
Team time = scoreboard.registerNewTeam("LobbyTime");
time.addEntry("§8» §cTime:");
time.setSuffix(" §7");
Team lobbyCount = scoreboard.registerNewTeam("LobbyCount");
lobbyCount.addEntry("§8» §cPlayers:");
lobbyCount.setSuffix(" §7");
scoreboards.put(player.getUniqueId(), scoreboard);
}
use of org.bukkit.scoreboard.Objective in project MassiveCore by MassiveCraft.
the class BoardUtil method clean.
// -------------------------------------------- //
// CLEAN
// -------------------------------------------- //
public static void clean(Player player) {
// Delete scores for temporary objectives.
for (Objective objective : getTemporaryObjectives()) {
setObjectiveValue(objective, player, 0);
}
// Delete player team if temporary and sole player.
for (Scoreboard board : getBoards()) {
Team team = getKeyTeam(board, player);
if (isTeamPersistent(team))
continue;
if (getTeamMembers(team).size() > 1)
continue;
deleteTeam(team);
}
}
Aggregations