mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-11-05 18:22:37 +01:00
Fixed bug with missing rank text in Top Ten
This commit is contained in:
parent
5e56943c63
commit
6160a3acee
@ -208,16 +208,33 @@ public class LevelsManager {
|
||||
|
||||
// Top Ten
|
||||
int i = 0;
|
||||
boolean inTopTen = false;
|
||||
for (Entry<UUID, Long> m : topTen.entrySet()) {
|
||||
panel.item(SLOTS[i], getHead(i++, m.getValue(), m.getKey(), user, world));
|
||||
PanelItem h = getHead((i+1), m.getValue(), m.getKey(), user, world);
|
||||
panel.item(SLOTS[i], h);
|
||||
// If this is also the asking player
|
||||
if (m.getKey().equals(user.getUniqueId())) {
|
||||
inTopTen = true;
|
||||
panel.item(49, h);
|
||||
setClickHandler(h, user, world);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
// Show remaining slots
|
||||
for (; i < SLOTS.length; i++) {
|
||||
panel.item(SLOTS[i], new PanelItemBuilder().icon(Material.GREEN_STAINED_GLASS_PANE).name(String.valueOf(i + 1)).build());
|
||||
}
|
||||
|
||||
// Add yourself
|
||||
PanelItem head = getHead(0, this.getIslandLevel(world, user.getUniqueId()), user.getUniqueId(), user, world);
|
||||
// Add yourself if you were not already in the top ten
|
||||
if (!inTopTen) {
|
||||
PanelItem head = getHead(0, this.getIslandLevel(world, user.getUniqueId()), user.getUniqueId(), user, world);
|
||||
setClickHandler(head, user, world);
|
||||
panel.item(49, head);
|
||||
}
|
||||
panel.build();
|
||||
}
|
||||
|
||||
private void setClickHandler(PanelItem head, User user, World world) {
|
||||
head.setClickHandler((p, u, ch, s) -> {
|
||||
new TabbedPanelBuilder()
|
||||
.user(user)
|
||||
@ -231,8 +248,7 @@ public class LevelsManager {
|
||||
.build().openPanel();
|
||||
return true;
|
||||
});
|
||||
panel.item(49, head);
|
||||
panel.build();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user