11package me .kodysimpson .simpapi .menu ;
22
3+ import me .kodysimpson .simpapi .colors .ColorTranslator ;
34import me .kodysimpson .simpapi .exceptions .MenuManagerException ;
45import me .kodysimpson .simpapi .exceptions .MenuManagerNotSetupException ;
56import org .bukkit .Bukkit ;
1314import org .jetbrains .annotations .NotNull ;
1415
1516import java .util .Arrays ;
17+ import java .util .stream .Collectors ;
1618
1719/*
1820 Defines the behavior and attributes of all menus in our plugin
@@ -95,7 +97,10 @@ public void setFillerGlass(){
9597 }
9698 }
9799 }
98-
100+
101+ /**
102+ * @param itemStack Placed into every empty slot when ran
103+ */
99104 public void setFillerGlass (ItemStack itemStack ) {
100105 for (int i = 0 ; i < getSlots (); i ++) {
101106 if (inventory .getItem (i ) == null ){
@@ -104,14 +109,21 @@ public void setFillerGlass(ItemStack itemStack) {
104109 }
105110 }
106111
112+ /**
113+ * @param material The material to base the ItemStack on
114+ * @param displayName The display name of the ItemStack
115+ * @param lore The lore of the ItemStack, with the Strings being automatically color coded with ColorTranslator
116+ * @return The constructed ItemStack object
117+ */
107118 public ItemStack makeItem (Material material , String displayName , String ... lore ) {
108119
109120 ItemStack item = new ItemStack (material );
110121 ItemMeta itemMeta = item .getItemMeta ();
111122 assert itemMeta != null ;
112123 itemMeta .setDisplayName (displayName );
113124
114- itemMeta .setLore (Arrays .asList (lore ));
125+ //Automatically translate color codes provided
126+ itemMeta .setLore (Arrays .stream (lore ).map (ColorTranslator ::translateColorCodes ).collect (Collectors .toList ()));
115127 item .setItemMeta (itemMeta );
116128
117129 return item ;
0 commit comments