1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +01:00

More obvious way to show that you can add more than 45 items into shop

This commit is contained in:
Zrips 2022-02-07 15:48:12 +02:00
parent faa72b80ac
commit 137ec98ab0

View File

@ -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<ShopItem> ls, int page) {
private static GUIRows getGuiSize(List<ShopItem> 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<String> 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);
}