Skip to content

Commit

Permalink
Allow storage of ENUMs to the scriptEntry to be auto-converted to Ele…
Browse files Browse the repository at this point in the history
…ments by using scriptEntry.getdObject(...).
  • Loading branch information
aufdemrand committed Nov 10, 2013
1 parent d3ca23b commit f855e78
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/net/aufdemrand/denizen/scripts/ScriptEntry.java
Expand Up @@ -201,7 +201,12 @@ public Object getObject(String key) {

public dObject getdObject(String key) {
try {
// If an ENUM, return as an Element
if (objects.get(key.toUpperCase()) instanceof Enum)
return new Element(((Enum) objects.get(key.toUpperCase())).name());
// Otherwise, just return the stored dObject
return (dObject) objects.get(key.toUpperCase());
// If not a dObject, return null
} catch (Exception e) { return null; }
}

Expand Down

0 comments on commit f855e78

Please sign in to comment.