Skip to content

Commit

Permalink
Listen to dScript.yaml_key errors
Browse files Browse the repository at this point in the history
Try to identify errors
  • Loading branch information
mcmonkey4eva committed Oct 21, 2014
1 parent 9ecfccd commit 7f2850b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/net/aufdemrand/denizen/objects/dScript.java
Expand Up @@ -11,6 +11,7 @@
import net.aufdemrand.denizen.tags.Attribute;
import net.aufdemrand.denizen.tags.TagManager;
import net.aufdemrand.denizen.utilities.DenizenAPI;
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.aufdemrand.denizencore.utilities.YamlConfiguration;

public class dScript implements dObject {
Expand Down Expand Up @@ -340,7 +341,17 @@ else return new Element(TagManager.tag(attribute.getScriptEntry() == null ? null
// -->
if (attribute.startsWith("yaml_key")
&& attribute.hasContext(1)) {
Object obj = getContainer().getConfigurationSection("").get(attribute.getContext(1).toUpperCase());
ScriptContainer container = getContainer();
if (container == null) {
dB.echoError("Missing script container?!");
return new Element(identify()).getAttribute(attribute);
}
YamlConfiguration section = container.getConfigurationSection("");
if (section == null) {
dB.echoError("Missing YAML section?!");
return new Element(identify()).getAttribute(attribute);
}
Object obj = section.get(attribute.getContext(1).toUpperCase());
if (obj == null) return Element.NULL.getAttribute(attribute.fulfill(1));

if (obj instanceof List) {
Expand Down

0 comments on commit 7f2850b

Please sign in to comment.