Skip to content

Commit

Permalink
add dItem.scriptname
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 11, 2013
1 parent 0fdcdf3 commit 2ad6ee9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/net/aufdemrand/denizen/objects/dItem.java
Expand Up @@ -612,6 +612,21 @@ public String getAttribute(Attribute attribute) {

}

if (attribute.startsWith("scriptname")) { // Note: Update this when the id: is stored less stupidly!
if (getItemStack().hasItemMeta() && getItemStack().getItemMeta().hasLore()) {

List<String> loreList = new ArrayList<String>();

for (String itemLore : getItemStack().getItemMeta().getLore()) {
if (itemLore.startsWith("§0id:")) {
return new Element(itemLore.substring(5)).getAttribute(attribute.fulfill(1));
}
}
return new Element("null").getAttribute(attribute.fulfill(1));
}
return new Element("null").getAttribute(attribute.fulfill(1));
}

// Return all lore except for lore that holds item script ID
if (attribute.startsWith("lore")) {
if (getItemStack().hasItemMeta() && getItemStack().getItemMeta().hasLore()) {
Expand Down

0 comments on commit 2ad6ee9

Please sign in to comment.