From db8dbeff4ca5378f694f2f12eb7f2f2a00b4edd0 Mon Sep 17 00:00:00 2001 From: Fabrizio La Rosa Date: Sun, 21 Jun 2020 19:52:45 +0200 Subject: [PATCH] Arrows in ban gui --- .../com/songoda/skyblock/gui/wip/GuiBans.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/songoda/skyblock/gui/wip/GuiBans.java b/src/main/java/com/songoda/skyblock/gui/wip/GuiBans.java index 5c98531c..53fa9637 100644 --- a/src/main/java/com/songoda/skyblock/gui/wip/GuiBans.java +++ b/src/main/java/com/songoda/skyblock/gui/wip/GuiBans.java @@ -70,7 +70,25 @@ public class GuiBans extends Gui { if(bans.size() == 0){ setItem(31, CompatibleMaterial.BARRIER.getItem()); } else { - for (int i = 9; i < ((getRows()-2)*9)+18; i++) { // TODO check dynamic dimension! - Arrows! + this.pages = (int) Math.max(1, Math.ceil((double) bans.size() / 36d)); + + if (page != 1) + setButton(5, 2, GuiUtils.createButtonItem(CompatibleMaterial.ARROW, + TextUtils.formatText(languageLoad.getString("Menu.Bank.Item.Last.Displayname"))), + (event) -> { + page--; + paint(); + }); + + if (page != pages) + setButton(5, 6, GuiUtils.createButtonItem(CompatibleMaterial.ARROW, + TextUtils.formatText(languageLoad.getString("Menu.Bank.Item.Next.Displayname"))), + (event) -> { + page++; + paint(); + }); + + for (int i = 9; i < ((getRows()-2)*9)+18; i++) { int current = ((page - 1) * 36) - 18; if (current + i >= bans.size()) { setItem(i, null);