19
19
import java .util .Optional ;
20
20
21
21
/**
22
- * GUI which shows all items in a {@link BiomeCategory} and allows players to purchase them.
22
+ * GUI which shows all biomes in a {@link BiomeCategory} and allows players to purchase them.
23
23
*/
24
24
public class BiomeCategoryGUI extends GUI {
25
25
@@ -28,7 +28,7 @@ public class BiomeCategoryGUI extends GUI {
28
28
/**
29
29
* The default constructor.
30
30
*
31
- * @param category The category whose items should be displayed in this GUI
31
+ * @param category The category whose biomes should be displayed in this GUI
32
32
*/
33
33
public BiomeCategoryGUI (BiomeCategory category , Inventory previousInventory ) {
34
34
super (previousInventory );
@@ -44,7 +44,7 @@ public BiomeCategoryGUI(BiomeCategory category, Inventory previousInventory) {
44
44
@ Override
45
45
public Inventory getInventory () {
46
46
Inventory inventory = Bukkit .createInventory (this , category .size , StringUtils .color (IridiumSkyblock .getInstance ().getBiomes ().categoryTitle
47
- .replace ("%category_name %" , category .name )
47
+ .replace ("%biomecategory_name %" , category .name )
48
48
));
49
49
50
50
Bukkit .getScheduler ().runTaskAsynchronously (IridiumSkyblock .getInstance (), () -> addContent (inventory ));
@@ -61,20 +61,20 @@ public void addContent(Inventory inventory) {
61
61
62
62
InventoryUtils .fillInventory (inventory , IridiumSkyblock .getInstance ().getBiomes ().categoryBackground );
63
63
64
- for (BiomeItem item : category .items ) {
65
- ItemStack itemStack = item .item .parseItem ();
64
+ for (BiomeItem biomeItem : category .items ) {
65
+ ItemStack itemStack = biomeItem .item .parseItem ();
66
66
ItemMeta itemMeta = itemStack .getItemMeta ();
67
67
68
- itemStack .setAmount (item .defaultAmount );
69
- itemMeta .setDisplayName (StringUtils .color (item .name ));
68
+ itemStack .setAmount (biomeItem .defaultAmount );
69
+ itemMeta .setDisplayName (StringUtils .color (biomeItem .name ));
70
70
71
- List <String > lore = item .lore == null ? new ArrayList <>() : new ArrayList <>(StringUtils .color (item .lore ));
72
- addBiomeLore (lore , item );
71
+ List <String > lore = biomeItem .lore == null ? new ArrayList <>() : new ArrayList <>(StringUtils .color (biomeItem .lore ));
72
+ addBiomeLore (lore , biomeItem );
73
73
74
74
itemMeta .setLore (lore );
75
75
itemStack .setItemMeta (itemMeta );
76
76
77
- inventory .setItem (item .slot , itemStack );
77
+ inventory .setItem (biomeItem .slot , itemStack );
78
78
}
79
79
80
80
if (IridiumSkyblock .getInstance ().getConfiguration ().backButtons && getPreviousInventory () != null ) {
@@ -107,24 +107,21 @@ public void onInventoryClick(InventoryClickEvent event) {
107
107
}
108
108
}
109
109
110
- private void addBiomeLore (List <String > lore , BiomeItem item ) {
111
- if (item .isPurchasable ()) {
110
+ private void addBiomeLore (List <String > lore , BiomeItem biomeItem ) {
111
+ if (biomeItem .isPurchasable ()) {
112
112
lore .add (
113
113
StringUtils .color (IridiumSkyblock .getInstance ().getBiomes ().buyPriceLore
114
- .replace ("%amount%" , String .valueOf (item .defaultAmount ))
115
- .replace ("%buy_price_vault%" , formatPrice (item .buyCost .vault ))
116
- .replace ("%buy_price_crystals%" , formatPrice (item .buyCost .crystals ))
114
+ .replace ("%amount%" , String .valueOf (biomeItem .defaultAmount ))
115
+ .replace ("%buy_price_vault%" , formatPrice (biomeItem .buyCost .vault ))
116
+ .replace ("%buy_price_crystals%" , formatPrice (biomeItem .buyCost .crystals ))
117
117
)
118
118
);
119
119
} else {
120
120
lore .add (StringUtils .color (IridiumSkyblock .getInstance ().getBiomes ().notPurchasableLore ));
121
121
}
122
122
123
123
IridiumSkyblock .getInstance ().getBiomes ().biomeItemLore .stream ()
124
- .map (StringUtils ::color )
125
- .forEach (line -> lore .add (
126
- line .replace ("%amount%" , String .valueOf (item .defaultAmount ))
127
- ));
124
+ .map (StringUtils ::color );
128
125
}
129
126
130
127
private String formatPrice (double value ) {
0 commit comments