mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-04 23:37:49 +01:00
Fix remained action types of job not included on the next page
Instead it duplicated the existing ones
This commit is contained in:
parent
1daf097f2e
commit
bb135043b5
@ -197,6 +197,8 @@ public class GuiManager {
|
|||||||
nextButton = Jobs.getGCManager().getJobsGUINextButton(),
|
nextButton = Jobs.getGCManager().getJobsGUINextButton(),
|
||||||
backButton = Jobs.getGCManager().getJobsGUIBackButton();
|
backButton = Jobs.getGCManager().getJobsGUIBackButton();
|
||||||
|
|
||||||
|
final List<ActionType> jobsRemained = new ArrayList<>();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (ActionType actionType : ActionType.values()) {
|
for (ActionType actionType : ActionType.values()) {
|
||||||
List<JobInfo> info = job.getJobInfo(actionType);
|
List<JobInfo> info = job.getJobInfo(actionType);
|
||||||
@ -208,6 +210,10 @@ public class GuiManager {
|
|||||||
|
|
||||||
int y = 1;
|
int y = 1;
|
||||||
for (int z = 0; z < info.size(); z++) {
|
for (int z = 0; z < info.size(); z++) {
|
||||||
|
if (i > 53) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
JobInfo jInfo = info.get(z);
|
JobInfo jInfo = info.get(z);
|
||||||
if (jInfo == null) {
|
if (jInfo == null) {
|
||||||
continue;
|
continue;
|
||||||
@ -251,10 +257,6 @@ public class GuiManager {
|
|||||||
if (z == info.size() - 1)
|
if (z == info.size() - 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (i >= 54) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemMeta meta = guiItem.getItemMeta();
|
ItemMeta meta = guiItem.getItemMeta();
|
||||||
meta.setDisplayName(job.getNameWithColor());
|
meta.setDisplayName(job.getNameWithColor());
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
@ -270,8 +272,9 @@ public class GuiManager {
|
|||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i >= 54) {
|
if (i > 53) {
|
||||||
break;
|
jobsRemained.add(actionType);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemMeta meta = guiItem.getItemMeta();
|
ItemMeta meta = guiItem.getItemMeta();
|
||||||
@ -318,20 +321,13 @@ public class GuiManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i >= 53) {
|
if (i >= 53 && !jobsRemained.isEmpty()) {
|
||||||
ItemStack next = Jobs.getGCManager().guiNextButton;
|
ItemStack next = Jobs.getGCManager().guiNextButton;
|
||||||
ItemMeta meta = next.getItemMeta();
|
ItemMeta meta = next.getItemMeta();
|
||||||
|
|
||||||
meta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.next"));
|
meta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.next"));
|
||||||
next.setItemMeta(meta);
|
next.setItemMeta(meta);
|
||||||
|
|
||||||
List<ActionType> jobsRemained = new ArrayList<>();
|
|
||||||
for (ActionType actionType : ActionType.values()) {
|
|
||||||
List<JobInfo> info = job.getJobInfo(actionType);
|
|
||||||
if (info != null && !info.isEmpty() && info.size() <= guiSize)
|
|
||||||
jobsRemained.add(actionType);
|
|
||||||
}
|
|
||||||
|
|
||||||
gui.addButton(new CMIGuiButton(nextButton, next) {
|
gui.addButton(new CMIGuiButton(nextButton, next) {
|
||||||
@Override
|
@Override
|
||||||
public void click(GUIClickType type) {
|
public void click(GUIClickType type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user