diff --git a/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java b/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java index 960870bd..1e8dd2e3 100644 --- a/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java +++ b/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java @@ -197,6 +197,8 @@ public class GuiManager { nextButton = Jobs.getGCManager().getJobsGUINextButton(), backButton = Jobs.getGCManager().getJobsGUIBackButton(); + final List jobsRemained = new ArrayList<>(); + int i = 0; for (ActionType actionType : ActionType.values()) { List info = job.getJobInfo(actionType); @@ -208,6 +210,10 @@ public class GuiManager { int y = 1; for (int z = 0; z < info.size(); z++) { + if (i > 53) { + break; + } + JobInfo jInfo = info.get(z); if (jInfo == null) { continue; @@ -251,10 +257,6 @@ public class GuiManager { if (z == info.size() - 1) continue; - if (i >= 54) { - break; - } - ItemMeta meta = guiItem.getItemMeta(); meta.setDisplayName(job.getNameWithColor()); meta.setLore(lore); @@ -270,8 +272,9 @@ public class GuiManager { y++; } - if (i >= 54) { - break; + if (i > 53) { + jobsRemained.add(actionType); + continue; } ItemMeta meta = guiItem.getItemMeta(); @@ -318,20 +321,13 @@ public class GuiManager { }); } - if (i >= 53) { + if (i >= 53 && !jobsRemained.isEmpty()) { ItemStack next = Jobs.getGCManager().guiNextButton; ItemMeta meta = next.getItemMeta(); meta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.next")); next.setItemMeta(meta); - List jobsRemained = new ArrayList<>(); - for (ActionType actionType : ActionType.values()) { - List info = job.getJobInfo(actionType); - if (info != null && !info.isEmpty() && info.size() <= guiSize) - jobsRemained.add(actionType); - } - gui.addButton(new CMIGuiButton(nextButton, next) { @Override public void click(GUIClickType type) {