mirror of
https://github.com/songoda/SongodaCore.git
synced 2025-01-14 19:41:24 +01:00
only update nav buttons if there are buttons
This commit is contained in:
parent
9589801db7
commit
bb3f26e1a8
@ -47,7 +47,7 @@ public class Gui {
|
||||
protected final Map<Integer, ItemStack> cellItems = new HashMap<>();
|
||||
protected final Map<Integer, Map<ClickType, Clickable>> conditionalButtons = new HashMap<>();
|
||||
protected ItemStack blankItem = GuiUtils.getBorderGlassItem();
|
||||
protected int nextPageIndex, prevPageIndex;
|
||||
protected int nextPageIndex = -1, prevPageIndex = -1;
|
||||
protected ItemStack nextPage, prevPage;
|
||||
protected Gui parent = null;
|
||||
protected static ItemStack AIR = new ItemStack(Material.AIR);
|
||||
@ -650,12 +650,15 @@ public class Gui {
|
||||
}
|
||||
|
||||
protected void updatePageNavigation() {
|
||||
if(prevPage != null) {
|
||||
if (page > 1) {
|
||||
this.setButton(prevPageIndex, prevPage, ClickType.LEFT, (event) -> this.prevPage());
|
||||
} else {
|
||||
this.setItem(prevPageIndex, null);
|
||||
this.clearActions(prevPageIndex);
|
||||
}
|
||||
}
|
||||
if(nextPage != null) {
|
||||
if (pages > 1 && page != pages) {
|
||||
this.setButton(nextPageIndex, nextPage, ClickType.LEFT, (event) -> this.nextPage());
|
||||
} else {
|
||||
@ -663,6 +666,7 @@ public class Gui {
|
||||
this.clearActions(nextPageIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Inventory getOrCreateInventory(@NotNull GuiManager manager) {
|
||||
|
Loading…
Reference in New Issue
Block a user