Skip to content

Commit

Permalink
Tiny fix to Give command.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcernat committed Jul 15, 2013
1 parent eca22ad commit ae4980a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/main/java/net/aufdemrand/denizen/objects/Element.java
Expand Up @@ -205,12 +205,21 @@ else if (element.toLowerCase().contains(contains.toLowerCase()))
else return new Element("false").getAttribute(attribute.fulfill(1));
}

// Get the substring after a certain text
if (attribute.startsWith("after")) {
String delimiter = attribute.getContext(1);
return new Element(String.valueOf(element.substring
(element.indexOf(delimiter) + delimiter.length())))
.getAttribute(attribute.fulfill(1));
}

// Get the substring before a certain text
if (attribute.startsWith("before")) {
String delimiter = attribute.getContext(1);
return new Element(String.valueOf(element.substring
(0, element.indexOf(delimiter))))
.getAttribute(attribute.fulfill(1));
}

if (attribute.startsWith("substring")) { // substring[2,8]
int beginning_index = Integer.valueOf(attribute.getContext(1).split(",")[0]) - 1;
Expand Down
Expand Up @@ -59,7 +59,7 @@ else if (aH.matchesArg("ENGRAVE", thisArg))
engrave = true;

else if (aH.matchesItem(thisArg) || aH.matchesItem("item:" + thisArg)) {
item = dItem.valueOf(aH.getStringFrom(thisArg), scriptEntry.getPlayer(), scriptEntry.getNPC());
item = dItem.valueOf(thisArg, scriptEntry.getPlayer(), scriptEntry.getNPC());
type = GiveType.ITEM;
}

Expand Down

0 comments on commit ae4980a

Please sign in to comment.