1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-01 23:13:48 +01:00

Lets properly resize GUI by required slots.

This commit is contained in:
Zrips 2018-12-23 11:03:18 +02:00
parent c9f15c8ad4
commit 0439d5eeda

View File

@ -22,6 +22,7 @@ import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobInfo; import com.gamingmesh.jobs.container.JobInfo;
import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.Debug;
public class GuiManager { public class GuiManager {
@ -75,8 +76,11 @@ public class GuiManager {
if (title.length() > 32) if (title.length() > 32)
title = title.substring(0, 30) + ".."; title = title.substring(0, 30) + "..";
int neededSlots = JobsList.size() + ((JobsList.size() / Jobs.getGCManager().getJobsGUIGroupAmount()) * Jobs.getGCManager().getJobsGUISkipAmount()) + Jobs.getGCManager().getJobsGUIStartPosition();
int neededRows = (int) Math.ceil(neededSlots / 9D);
// Resizing GUI in case we have more jobs then we could fit in current setup // Resizing GUI in case we have more jobs then we could fit in current setup
GuiSize = GuiSize - 18 - ((Jobs.getGCManager().getJobsGUIRows() - 2) * 2) < JobsList.size() ? 2 * 9 + ((JobsList.size() % 9) * 9) : GuiSize; GuiSize = Jobs.getGCManager().getJobsGUIRows() > neededRows ? GuiSize : neededRows * 9;
// Lets avoid oversized GUI // Lets avoid oversized GUI
GuiSize = GuiSize > 54 ? 54 : GuiSize; GuiSize = GuiSize > 54 ? 54 : GuiSize;