mirror of https://github.com/tomasff/BeesPlus.git
40 lines
823 B
Java
40 lines
823 B
Java
package com.tomff.beesplus.core.items;
|
|
|
|
import org.bukkit.Material;
|
|
import org.bukkit.inventory.ItemStack;
|
|
import org.bukkit.inventory.meta.ItemMeta;
|
|
|
|
import java.util.Arrays;
|
|
|
|
public class ItemBuilder {
|
|
private ItemStack item;
|
|
|
|
public ItemBuilder(Material material) {
|
|
this.item = new ItemStack(material, 1);
|
|
}
|
|
|
|
public ItemBuilder setName(String name) {
|
|
ItemMeta meta = item.getItemMeta();
|
|
|
|
if (meta != null) {
|
|
meta.setDisplayName(name);
|
|
item.setItemMeta(meta);
|
|
}
|
|
|
|
return this;
|
|
}
|
|
|
|
public ItemBuilder setLore(String... lore) {
|
|
ItemMeta meta = item.getItemMeta();
|
|
meta.setLore(Arrays.asList(lore));
|
|
|
|
item.setItemMeta(meta);
|
|
|
|
return this;
|
|
}
|
|
|
|
public ItemStack build() {
|
|
return item;
|
|
}
|
|
}
|