mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-10-01 08:07:34 +02:00
Fixes a bug where not items were shown in settings
The addition of a bottom control bar to the tab was covering up the panel items so 9 items would be missing. This makes it so 36 items show instead of 45.
This commit is contained in:
parent
5e0e19a1be
commit
83c0713ddf
@ -29,6 +29,7 @@ import world.bentobox.bentobox.api.user.User;
|
|||||||
public class TabbedPanel extends Panel implements PanelListener {
|
public class TabbedPanel extends Panel implements PanelListener {
|
||||||
|
|
||||||
private static final String PROTECTION_PANEL = "protection.panel.";
|
private static final String PROTECTION_PANEL = "protection.panel.";
|
||||||
|
private static final long ITEMS_PER_PAGE = 36;
|
||||||
private final TabbedPanelBuilder tpb;
|
private final TabbedPanelBuilder tpb;
|
||||||
private @NonNull BentoBox plugin = BentoBox.getInstance();
|
private @NonNull BentoBox plugin = BentoBox.getInstance();
|
||||||
private int activeTab;
|
private int activeTab;
|
||||||
@ -95,7 +96,7 @@ public class TabbedPanel extends Panel implements PanelListener {
|
|||||||
if (tpb.getTabs().containsKey(activeTab)) {
|
if (tpb.getTabs().containsKey(activeTab)) {
|
||||||
List<PanelItem> panelItems = tab.getPanelItems();
|
List<PanelItem> panelItems = tab.getPanelItems();
|
||||||
// Adds the flag items
|
// Adds the flag items
|
||||||
panelItems.stream().filter(Objects::nonNull).skip(page * 45L).limit(page * 45L + 45L).forEach(i -> items.put(items.lastKey() + 1, i));
|
panelItems.stream().filter(Objects::nonNull).skip(page * ITEMS_PER_PAGE).limit(page * ITEMS_PER_PAGE + ITEMS_PER_PAGE).forEach(i -> items.put(items.lastKey() + 1, i));
|
||||||
|
|
||||||
// set up the footer
|
// set up the footer
|
||||||
setupFooter(items);
|
setupFooter(items);
|
||||||
@ -108,7 +109,7 @@ public class TabbedPanel extends Panel implements PanelListener {
|
|||||||
return true;
|
return true;
|
||||||
}).build());
|
}).build());
|
||||||
}
|
}
|
||||||
if ((page + 1) * 45L < panelItems.stream().filter(Objects::nonNull).count()) {
|
if ((page + 1) * ITEMS_PER_PAGE < panelItems.stream().filter(Objects::nonNull).count()) {
|
||||||
// Next page icon
|
// Next page icon
|
||||||
items.put(52, new PanelItemBuilder().icon(Material.ARROW).name(tpb.getUser().getTranslation(PROTECTION_PANEL + "next")).clickHandler((panel, user1, clickType, slot1) -> {
|
items.put(52, new PanelItemBuilder().icon(Material.ARROW).name(tpb.getUser().getTranslation(PROTECTION_PANEL + "next")).clickHandler((panel, user1, clickType, slot1) -> {
|
||||||
this.activePage++;
|
this.activePage++;
|
||||||
|
Loading…
Reference in New Issue
Block a user