mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-12-17 22:17:38 +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
|
// Top Ten
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
boolean inTopTen = false;
|
||||||
for (Entry<UUID, Long> m : topTen.entrySet()) {
|
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
|
// Show remaining slots
|
||||||
for (; i < SLOTS.length; i++) {
|
for (; i < SLOTS.length; i++) {
|
||||||
panel.item(SLOTS[i], new PanelItemBuilder().icon(Material.GREEN_STAINED_GLASS_PANE).name(String.valueOf(i + 1)).build());
|
panel.item(SLOTS[i], new PanelItemBuilder().icon(Material.GREEN_STAINED_GLASS_PANE).name(String.valueOf(i + 1)).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add yourself
|
// 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);
|
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) -> {
|
head.setClickHandler((p, u, ch, s) -> {
|
||||||
new TabbedPanelBuilder()
|
new TabbedPanelBuilder()
|
||||||
.user(user)
|
.user(user)
|
||||||
@ -231,8 +248,7 @@ public class LevelsManager {
|
|||||||
.build().openPanel();
|
.build().openPanel();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
panel.item(49, head);
|
|
||||||
panel.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user