Skip to content

Commit

Permalink
Add "set_lore" mechanism for dItems
Browse files Browse the repository at this point in the history
I also reworked dItem mechs a bit, nothing major though.
  • Loading branch information
Morphan1 committed Dec 12, 2013
1 parent 0f1bae2 commit 3333265
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/main/java/net/aufdemrand/denizen/objects/dItem.java
Expand Up @@ -879,22 +879,40 @@ public String getAttribute(Attribute attribute) {
@Override
public void adjust(Mechanism mechanism, Element value) {

ItemMeta meta = item.getItemMeta();

// <--[mechanism]
// @object dItem
// @name set_display
// @input <element>
// @input Element
// @description
// Changes the items display name.
// @tags
// <i@item.display>
// -->
if (mechanism.matches("set_display")) {
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(value.asString());
item.setItemMeta(meta);
return;
}

// <--[mechanism]
// @object dItem
// @name set_lore
// @input dList
// @description
// Sets the item's lore.
// @tags
// <i@item.lore>
// -->
if (mechanism.matches("set_lore")) {
meta.setLore(dList.valueOf(value.asString()));
}

if (mechanism.matches("add_enchant")) {
// meta.addEnchant(Enchantment.getByName(value.asString()), TODO:(int) level, TODO:(boolean) ignoreLevelRestriction);
}

item.setItemMeta(meta);

}

}

0 comments on commit 3333265

Please sign in to comment.