File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed
src/main/java/me/kodysimpson/simpapi/items Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 1- # SimpAPI v4.3.2
1+ # SimpAPI v4.4.0
22
33## Table Of Contents:
44****
Original file line number Diff line number Diff line change 66
77 <groupId >me.kodysimpson</groupId >
88 <artifactId >SimpAPI</artifactId >
9- <version >4.3.2 </version >
9+ <version >4.4.0 </version >
1010 <packaging >jar</packaging >
1111
1212 <name >SimpAPI</name >
Original file line number Diff line number Diff line change 1+ package me .kodysimpson .simpapi .items ;
2+
3+ import me .kodysimpson .simpapi .colors .ColorTranslator ;
4+ import org .bukkit .Material ;
5+ import org .bukkit .inventory .ItemStack ;
6+ import org .bukkit .inventory .meta .ItemMeta ;
7+
8+ import java .util .Arrays ;
9+ import java .util .stream .Collectors ;
10+
11+ /**
12+ * Class for Utilities related to Minecraft/Bukkit Items
13+ */
14+ public class ItemUtils {
15+
16+ /**
17+ * @param material The material to base the ItemStack on
18+ * @param displayName The display name of the ItemStack
19+ * @param lore The lore of the ItemStack, with the Strings being automatically color coded with ColorTranslator
20+ * @return The constructed ItemStack object
21+ */
22+ public static ItemStack makeItem (Material material , String displayName , String ... lore ) {
23+
24+ ItemStack item = new ItemStack (material );
25+ ItemMeta itemMeta = item .getItemMeta ();
26+ assert itemMeta != null ;
27+ itemMeta .setDisplayName (displayName );
28+
29+ //Automatically translate color codes provided
30+ itemMeta .setLore (Arrays .stream (lore ).map (ColorTranslator ::translateColorCodes ).collect (Collectors .toList ()));
31+ item .setItemMeta (itemMeta );
32+
33+ return item ;
34+ }
35+
36+ }
You can’t perform that action at this time.
0 commit comments