ItemStack within a configuration
Next, we will expand the MobEnhancer
plugin even further by allowing the option of giving armor and weapons to zombies and skeletons. In order to do this, we must first learn how to add an ItemStack
object as an option in a configuration file. An ItemStack
method is more complicated than a simple integer or double. It is an object that has many nested values. It may also include a
meta value, which will have more nested values. Meta contains additional information for the item, such as a custom display name or lines of text that make up the lore of the item. The following is a sample of an ItemStack
method in a YAML
file:
SampleItem: ==: org.bukkit.inventory.ItemStack type: DIAMOND_SWORD damage: 1500 amount: 1 meta: ==: ItemMeta meta-type: UNSPECIFIC display-name: §6Sample Item lore: - First line of lore - Second line of lore - §1Color §2support enchants: DAMAGE_ALL: 2 KNOCKBACK: 7 FIRE_ASPECT: 1...