Modifier and Type | Field and Description |
---|---|
protected int |
amount
The amount of items in the
ItemStack |
protected boolean |
autoTranslate
Specifies whether or not to automatically translate color codes
|
static String |
DEFAULT_PREFIX
Prefix for lore items because purple is ugly
|
protected short |
durability
The durability of the
ItemStack |
protected Map<Enchantment,Integer> |
enchantments
A mapping of
Enchantments to their levels |
protected List<String> |
lore
The lore for the
ItemStack |
protected String |
lorePrefix
A prefix that can be set for all lore
|
protected String |
name
The name for the
ItemStack |
protected Material |
type
|
Constructor and Description |
---|
ItemStackBuilder() |
Modifier and Type | Method and Description |
---|---|
ItemStackBuilder |
addEnchantment(Enchantment ench,
int level)
Adds an enchantment to the
ItemStack |
ItemStackBuilder |
addLore(String lore)
Adds lore to the
ItemStack |
ItemStackBuilder |
amount(int amount)
Sets the amount of items in the
ItemStack |
ItemStackBuilder |
autoTranslateColors(boolean autoTranslate)
Sets whether or not to automatically translate color codes
|
ItemStack |
build()
Builds the
ItemStack object and returns it |
ItemStackBuilder |
durability(short durability)
Sets the durability to apply to the
ItemStack |
ItemStackBuilder |
lorePrefix(String prefix)
Sets the prefix to use for all lore items
|
ItemStackBuilder |
name(String name)
Sets the display name for the
ItemStack |
ItemStackBuilder |
type(Material type)
|
public static final String DEFAULT_PREFIX
protected String lorePrefix
protected Map<Enchantment,Integer> enchantments
Enchantments
to their levelsprotected Material type
protected int amount
ItemStack
protected short durability
ItemStack
protected boolean autoTranslate
public ItemStackBuilder name(String name)
ItemStack
name
- The display namepublic ItemStackBuilder addLore(String lore)
ItemStack
lore
- The lore to addpublic ItemStackBuilder lorePrefix(String prefix)
prefix
- The prefix to setpublic ItemStackBuilder durability(short durability)
ItemStack
durability
- The durability to use (can also be a data value)public ItemStackBuilder autoTranslateColors(boolean autoTranslate)
autoTranslate
- true
to automatically translate '&
'public ItemStackBuilder addEnchantment(Enchantment ench, int level)
ItemStack
ench
- The Enchantment
to addlevel
- The level of the enchantmentpublic ItemStackBuilder type(Material type)
type
- The Material
type to setpublic ItemStackBuilder amount(int amount)
ItemStack
amount
- The amount to setpublic ItemStack build()
ItemStack
object and returns itItemStack
IllegalArgumentException
- If type is null
,
amount <= 0
, or
amount >
Material.getMaxStackSize()
Copyright © 2017. All rights reserved.