From 137ec98ab0a268f85878eb2c9f736b04648609de Mon Sep 17 00:00:00 2001 From: Zrips Date: Mon, 7 Feb 2022 15:48:12 +0200 Subject: [PATCH] More obvious way to show that you can add more than 45 items into shop --- .../gamingmesh/jobs/config/ShopManager.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/config/ShopManager.java b/src/main/java/com/gamingmesh/jobs/config/ShopManager.java index c0e75b4b..dc1f83c8 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ShopManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ShopManager.java @@ -38,6 +38,7 @@ import net.Zrips.CMILib.GUI.CMIGuiButton; import net.Zrips.CMILib.GUI.GUIManager.GUIClickType; import net.Zrips.CMILib.GUI.GUIManager.GUIRows; import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Logs.CMIDebug; import net.Zrips.CMILib.Version.Version; @SuppressWarnings("deprecation") @@ -58,28 +59,28 @@ public class ShopManager { return ls; } - private static GUIRows getGuiSize(List ls, int page) { + private static GUIRows getGuiSize(List ls, @Deprecated int page) { GUIRows guiSize = GUIRows.r1; int size = ls.size(); - if (size > 9) + if (size <= 9) + guiSize = GUIRows.r1; + + if (size <= 18) guiSize = GUIRows.r2; - if (size > 18) + if (size <= 27) guiSize = GUIRows.r3; - if (size > 27) + if (size <= 36) guiSize = GUIRows.r4; - if (size > 36) + if (size <= 45) guiSize = GUIRows.r5; - - if (size == 45) + + if (Jobs.getShopManager().getShopItemList().size() > 45) guiSize = GUIRows.r6; - if (page > 1 && guiSize != GUIRows.r6) - guiSize = GUIRows.getByRows(guiSize.getRows() + 1); - return guiSize; } @@ -124,7 +125,7 @@ public class ShopManager { } if (item.isHideIfNoEnoughPoints() && item.getRequiredTotalLevels() != -1 && - jPlayer.getTotalLevels() < item.getRequiredTotalLevels()) { + jPlayer.getTotalLevels() < item.getRequiredTotalLevels()) { mat = CMIMaterial.STONE_BUTTON; lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPoints")); } @@ -340,7 +341,7 @@ public class ShopManager { } sItem.setIconAmount(nameSection.getInt("Icon.Amount", 1)); - sItem.setIconName(CMIChatColor.translate(nameSection.getString("Icon.Name"))); + sItem.setIconName(CMIChatColor.translate(nameSection.getString("Icon.Name"))); List lore = nameSection.getStringList("Icon.Lore"); for (int b = 0; b < lore.size(); b++) { @@ -354,8 +355,8 @@ public class ShopManager { sItem.setCustomHeadOwner(nameSection.getBoolean("Icon.CustomHead.UseCurrentPlayer", true)); sItem.setHideIfThereIsNoEnoughPoints(nameSection.getBoolean("Icon.HideIfThereIsNoEnoughPoints")); - sItem.setHideWithoutPerm(nameSection.getBoolean("Icon.HideWithoutPermission")); - sItem.setRequiredPerm(nameSection.getStringList("RequiredPermission")); + sItem.setHideWithoutPerm(nameSection.getBoolean("Icon.HideWithoutPermission")); + sItem.setRequiredPerm(nameSection.getStringList("RequiredPermission")); if (nameSection.isInt("RequiredTotalLevels")) sItem.setRequiredTotalLevels(nameSection.getInt("RequiredTotalLevels")); @@ -452,7 +453,7 @@ public class ShopManager { } items.add(new JobItems(oneItemName.toLowerCase(), id == null ? CMIMaterial.STONE : CMIMaterial.get(id), amount, name, giveLore, - enchants, new BoostMultiplier(), new ArrayList<>(), potionData, null)); + enchants, new BoostMultiplier(), new ArrayList<>(), potionData, null)); } sItem.setitems(items); }