mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-25 03:55:22 +01:00
#40: Add player names to buttons
This commit is contained in:
parent
4fb23b482b
commit
2ee39cbba8
@ -418,6 +418,7 @@ public class Announcer {
|
|||||||
do {
|
do {
|
||||||
String name = ChatColor.DARK_GRAY + "EMPTY GROUP";
|
String name = ChatColor.DARK_GRAY + "EMPTY GROUP";
|
||||||
int playerCount = 0;
|
int playerCount = 0;
|
||||||
|
List<String> lore = new ArrayList<>();
|
||||||
|
|
||||||
DGroup dGroup = dGroups.get(groupCount);
|
DGroup dGroup = dGroups.get(groupCount);
|
||||||
if (!plugin.getDGroups().contains(dGroup)) {
|
if (!plugin.getDGroups().contains(dGroup)) {
|
||||||
@ -426,6 +427,9 @@ public class Announcer {
|
|||||||
} else if (dGroup != null) {
|
} else if (dGroup != null) {
|
||||||
name = ChatColor.AQUA + dGroup.getName();
|
name = ChatColor.AQUA + dGroup.getName();
|
||||||
playerCount = dGroup.getPlayers().size();
|
playerCount = dGroup.getPlayers().size();
|
||||||
|
for (Player player : dGroup.getPlayers()) {
|
||||||
|
lore.add((dGroup.getCaptain() == player ? ChatColor.GOLD : ChatColor.GRAY) + player.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean full = playerCount >= maxPlayersPerGroup;
|
boolean full = playerCount >= maxPlayersPerGroup;
|
||||||
@ -433,6 +437,7 @@ public class Announcer {
|
|||||||
ItemStack button = new ItemStack(Material.WOOL, playerCount, plugin.getMainConfig().getGroupColorPriority().get(groupCount));
|
ItemStack button = new ItemStack(Material.WOOL, playerCount, plugin.getMainConfig().getGroupColorPriority().get(groupCount));
|
||||||
ItemMeta meta = button.getItemMeta();
|
ItemMeta meta = button.getItemMeta();
|
||||||
meta.setDisplayName(name + (full ? ChatColor.DARK_RED : ChatColor.GREEN) + " [" + playerCount + "/" + maxPlayersPerGroup + "]");
|
meta.setDisplayName(name + (full ? ChatColor.DARK_RED : ChatColor.GREEN) + " [" + playerCount + "/" + maxPlayersPerGroup + "]");
|
||||||
|
meta.setLore(lore);
|
||||||
button.setItemMeta(meta);
|
button.setItemMeta(meta);
|
||||||
buttons.add(button);
|
buttons.add(button);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user