Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.tylercreator.guichunk.utilities;
- import java.util.ArrayList;
- import java.util.List;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- public class Utilities {
- public static String chat (String s) {
- return ChatColor.translateAlternateColorCodes('&', s);
- }
- public static ItemStack createItem(Inventory inv, int materialId, int amount, int invSlot, String displayName, String... loreString) {
- ItemStack item;
- List<String> lore = new ArrayList();
- item = new ItemStack(Material.getMaterial(materialId), amount);
- ItemMeta meta = item.getItemMeta();
- meta.setDisplayName(Utilities.chat(displayName));
- for (String s : loreString) {
- lore.add(Utilities.chat(s));
- }
- meta.setLore(lore);
- item.setItemMeta(meta);
- inv.setItem(invSlot - 1, item);
- return item;
- }
- public static ItemStack createItemByte(Inventory inv, int materialId, int amount, int byteId, int invSlot, String displayName, String... loreString) {
- ItemStack item;
- List<String> lore = new ArrayList();
- item = new ItemStack(Material.getMaterial(materialId), (short) byteId);
- ItemMeta meta = item.getItemMeta();
- meta.setDisplayName(Utilities.chat(displayName));
- for (String s : loreString) {
- lore.add(Utilities.chat(s));
- }
- meta.setLore(lore);
- item.setItemMeta(meta);
- inv.setItem(invSlot -1, item);
- return item;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement