From 455fb32cd82341e08afb4300095248c1624eac1e Mon Sep 17 00:00:00 2001 From: mcmonkey4eva Date: Sun, 7 Dec 2014 16:28:17 -0800 Subject: [PATCH] Don't complain when YAML tags have fallbacks Maybe we intentionally specified nonsense so the fallback would show. --- .../denizen/scripts/commands/core/YamlCommand.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/aufdemrand/denizen/scripts/commands/core/YamlCommand.java b/src/main/java/net/aufdemrand/denizen/scripts/commands/core/YamlCommand.java index 32f496e3ae..1c7e2ee70c 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/commands/core/YamlCommand.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/commands/core/YamlCommand.java @@ -440,7 +440,8 @@ public void yaml(ReplaceableTagEvent event) { } // YAML tag requires name context and type context. - if (!event.hasNameContext() || !(event.hasTypeContext() || attribute.getAttribute(2).equalsIgnoreCase("to_json"))) { + if ((!event.hasNameContext() || !(event.hasTypeContext() || attribute.getAttribute(2).equalsIgnoreCase("to_json"))) + && !attribute.hasAlternative()) { dB.echoError("YAML tag '" + event.raw_tag + "' is missing required context. Tag replacement aborted."); return; } @@ -450,7 +451,8 @@ public void yaml(ReplaceableTagEvent event) { String path = event.getTypeContext(); // Check if there is a yaml file loaded with the specified id - if (!yamls.containsKey(id.toUpperCase())) { + if (!yamls.containsKey(id.toUpperCase()) + && !attribute.hasAlternative()) { dB.echoError("YAML tag '" + event.raw_tag + "' has specified an invalid ID, or the specified id has already" + " been closed. Tag replacement aborted. ID given: '" + id + "'."); return;