use of xyz.derkades.ublisk.ext.com.coloredcarrot.api.sidebar.SidebarString in project Ublisk by Derkades.
the class Scoreboard method getScoreboard.
public static Sidebar getScoreboard(UPlayer player) {
String r = ChatColor.RESET.toString();
String redBold = RED + "" + BOLD;
List<String> strings = new ArrayList<String>();
strings.add(DARK_GRAY + "---------------");
strings.add(redBold + "XP");
strings.add(GRAY + "" + player.getXP() + " / " + CustomXP.getRequiredXP(player.getLevel() + 1));
strings.add(r + " ");
strings.add(redBold + "Health");
strings.add(GRAY + "" + player.getHealth() + " / " + player.getMaxHealth());
if (player.getFriends().size() > 1) {
boolean displayedOnlineFriends = false;
for (OfflinePlayer friend : player.getFriends()) {
if (friend != null && friend.isOnline()) {
if (!displayedOnlineFriends) {
strings.add(redBold + "Online Friends");
strings.add(r + r + r + "");
displayedOnlineFriends = true;
}
UPlayer online = new UPlayer(friend);
strings.add(ChatColor.DARK_AQUA + friend.getName() + DARK_GRAY + ": " + ChatColor.AQUA + Math.round(online.getHealth()) + "HP");
}
}
}
strings.add(r + DARK_GRAY + "---------------");
List<SidebarString> sidebarStrings = new ArrayList<SidebarString>();
for (String string : strings) sidebarStrings.add(new SidebarString(string));
String title = DARK_AQUA + "" + BOLD + "Information";
return new Sidebar(title, Main.getInstance(), Integer.MAX_VALUE, sidebarStrings.toArray(new SidebarString[] {}));
}
Aggregations