|
9 | 9 | import fr.openmc.core.features.homes.HomeLimits; |
10 | 10 | import fr.openmc.core.features.homes.HomeUpgradeManager; |
11 | 11 | import fr.openmc.core.features.homes.HomesManager; |
12 | | -import fr.openmc.core.registry.items.CustomItemRegistry; |
13 | 12 | import fr.openmc.core.utils.text.messages.TranslationManager; |
14 | 13 | import net.kyori.adventure.text.Component; |
15 | 14 | import net.kyori.adventure.text.format.NamedTextColor; |
@@ -44,36 +43,31 @@ public String getTexture() { |
44 | 43 | public @NotNull Map<Integer, ItemBuilder> getContent() { |
45 | 44 | Map<Integer, ItemBuilder> items = new HashMap<>(); |
46 | 45 |
|
47 | | - int currentHome = HomesManager.getHomeLimit(getOwner().getUniqueId()); |
48 | | - |
49 | | - int homeMaxLimit = HomeLimits.values().length - 1; |
50 | | - |
51 | | - HomeLimits lastUpgrade = HomeLimits.valueOf("LIMIT_" + homeMaxLimit); |
52 | | - HomeLimits nextUpgrade = HomeUpgradeManager.getNextUpgrade(HomeUpgradeManager.getCurrentUpgrade(getOwner())) != null |
53 | | - ? HomeUpgradeManager.getNextUpgrade(HomeUpgradeManager.getCurrentUpgrade(getOwner())) |
54 | | - : lastUpgrade; |
55 | | - |
56 | | - items.put(4, new ItemBuilder(this, Objects.requireNonNull(OMCRegistry.CUSTOM_ITEMS.get("omc_homes:omc_homes_icon_upgrade")).getBest(), itemMeta -> { |
57 | | - itemMeta.displayName(TranslationManager.translation("feature.homes.upgrade.item.name")); |
58 | | - if (nextUpgrade.getLimit() >= lastUpgrade.getLimit()) { |
59 | | - itemMeta.lore(TranslationManager.translationLore( |
60 | | - "feature.homes.upgrade.lore.max", |
61 | | - Component.text(currentHome).color(NamedTextColor.YELLOW) |
62 | | - )); |
63 | | - } else { |
64 | | - itemMeta.lore(TranslationManager.translationLore( |
65 | | - "feature.homes.upgrade.lore.available", |
66 | | - Component.text(currentHome).color(NamedTextColor.YELLOW), |
67 | | - Component.text(nextUpgrade.getPrice()).color(NamedTextColor.GREEN), |
68 | | - Component.text(EconomyManager.getEconomyIcon()).decoration(TextDecoration.ITALIC, false), |
69 | | - Component.text(nextUpgrade.getAyweniteCost()).color(NamedTextColor.LIGHT_PURPLE), |
70 | | - Component.text(nextUpgrade.getLimit()).color(NamedTextColor.YELLOW) |
71 | | - )); |
72 | | - } |
73 | | - }).setOnClick(event -> { |
74 | | - HomeUpgradeManager.upgradeHome(getOwner()); |
75 | | - getOwner().closeInventory(); |
76 | | - })); |
| 46 | + int currentHome = HomesManager.getHomeLimit(getOwner().getUniqueId()).getLimit(); |
| 47 | + |
| 48 | + HomeLimits nextUpgrade = HomeUpgradeManager.getNextUpgrade(HomeUpgradeManager.getCurrentUpgrade(getOwner())); |
| 49 | + |
| 50 | + items.put(4, new ItemBuilder(this, Objects.requireNonNull(OMCRegistry.CUSTOM_ITEMS.get("omc_homes:omc_homes_icon_upgrade")).getBest(), itemMeta -> { |
| 51 | + itemMeta.displayName(TranslationManager.translation("feature.homes.upgrade.item.name")); |
| 52 | + if (nextUpgrade == null) { |
| 53 | + itemMeta.lore(TranslationManager.translationLore( |
| 54 | + "feature.homes.upgrade.lore.max", |
| 55 | + Component.text(currentHome).color(NamedTextColor.YELLOW) |
| 56 | + )); |
| 57 | + } else { |
| 58 | + itemMeta.lore(TranslationManager.translationLore( |
| 59 | + "feature.homes.upgrade.lore.available", |
| 60 | + Component.text(currentHome).color(NamedTextColor.YELLOW), |
| 61 | + Component.text(nextUpgrade.getPrice()).color(NamedTextColor.GREEN), |
| 62 | + Component.text(EconomyManager.getEconomyIcon()).decoration(TextDecoration.ITALIC, false), |
| 63 | + Component.text(nextUpgrade.getAyweniteCost()).color(NamedTextColor.LIGHT_PURPLE), |
| 64 | + Component.text(nextUpgrade.getLimit()).color(NamedTextColor.YELLOW) |
| 65 | + )); |
| 66 | + } |
| 67 | + }).setOnClick(event -> { |
| 68 | + HomeUpgradeManager.upgradeHome(getOwner()); |
| 69 | + getOwner().closeInventory(); |
| 70 | + })); |
77 | 71 |
|
78 | 72 | return items; |
79 | 73 | } |
|
0 commit comments