Skip to content

Commit

Permalink
add as_Element to util tags
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed Jun 15, 2013
1 parent e8b01c2 commit 3b6af74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/main/java/net/aufdemrand/denizen/tags/core/UtilTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import net.aufdemrand.denizen.Denizen;
import net.aufdemrand.denizen.events.ReplaceableTagEvent;
import net.aufdemrand.denizen.tags.Attribute;
import net.aufdemrand.denizen.utilities.arguments.Element;
import net.aufdemrand.denizen.utilities.arguments.aH;

import org.bukkit.event.EventHandler;
Expand All @@ -23,6 +25,7 @@ public void utilTags(ReplaceableTagEvent event) {
if (!event.matches("UTIL")) return;

String type = event.getType() != null ? event.getType() : "";
String typeContext = event.getTypeContext() != null ? event.getTypeContext() : "";
String subType = event.getSubType() != null ? event.getSubType() : "";
String subTypeContext = event.getSubTypeContext() != null ? event.getSubTypeContext().toUpperCase() : "";
String specifier = event.getSpecifier() != null ? event.getSpecifier() : "";
Expand Down Expand Up @@ -113,6 +116,11 @@ else if (type.equalsIgnoreCase("DATE")) {

}

else if (type.equalsIgnoreCase("AS_ELEMENT")) {
Attribute attribute = new Attribute(event.raw_tag, event.getScriptEntry());
event.setReplaced(new Element(typeContext).getAttribute(attribute.fulfill(2)));
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static String debugUniqueObj(String prefix, String id, Object value) {
return "<G>" + prefix + "='<A>" + id + "<Y>(" + value.toString() + ")<G>' ";
}

private static class Argument {
public static class Argument {
String raw_value;
String prefix;
String value;
Expand Down

0 comments on commit 3b6af74

Please sign in to comment.