Skip to content

Commit

Permalink
Add durability node to item scripts
Browse files Browse the repository at this point in the history
Fixes #1021
  • Loading branch information
Morphan1 committed Jun 21, 2015
1 parent 944d3ea commit 3fdc7eb
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -53,13 +53,15 @@ public class ItemScriptContainer extends ScriptContainer {
// - item
// - ...
//
// # If you want an item to be damaged on creation, you can change its durability.
// durability: 12
//
// # Each line must specify a valid Bukkit enchantment. See 'enchantments' for more information.
// enchantments:
// - enchantment_name:level
// - ...
//
// # You can specify the items required to craft your item. For an empty slot, use i@air. Currently, Denizen only
// # supports shaped recipes.
// # You can specify the items required to craft your item. For an empty slot, use i@air.
// recipe:
// - i@item|i@item|i@item
// - i@item|i@item|i@item
Expand Down Expand Up @@ -218,6 +220,12 @@ public dItem getItemFrom(dPlayer player, dNPC npc) {
meta.setLore(lore);
stack.getItemStack().setItemMeta(meta);

// Set Durability
if (contains("DURABILITY")) {
short durability = Short.valueOf(getString("DURABILITY"));
stack.setDurability(durability);
}

// Set Enchantments
if (contains("ENCHANTMENTS")) {
for (String enchantment : getStringList("ENCHANTMENTS")) {
Expand Down

0 comments on commit 3fdc7eb

Please sign in to comment.