Skip to content

Commit

Permalink
Allow some special tag nesting cases
Browse files Browse the repository at this point in the history
Fallbacks and values should be allowed to contain tags
  • Loading branch information
mcmonkey4eva committed Sep 22, 2014
1 parent dc991d7 commit c68b743
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Expand Up @@ -8,6 +8,7 @@
import net.aufdemrand.denizen.scripts.ScriptEntry;
import net.aufdemrand.denizen.tags.Attribute;

import net.aufdemrand.denizen.tags.TagManager;
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.event.Event;
Expand Down Expand Up @@ -215,7 +216,8 @@ public boolean hasSpecifierContext() {
// Value

public String getValue() {
return value;
return TagManager.CleanOutputFully(TagManager.tag(
getPlayer(), getNPC(), value, false, getScriptEntry()));
}

public boolean hasValue() {
Expand All @@ -225,7 +227,8 @@ public boolean hasValue() {
// Alternative

public String getAlternative() {
return alternative;
return TagManager.CleanOutputFully(TagManager.tag(
getPlayer(), getNPC(), alternative, false, getScriptEntry()));
}

public boolean hasAlternative() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/aufdemrand/denizen/tags/TagManager.java
Expand Up @@ -204,7 +204,7 @@ public static String tag(dPlayer player, dNPC npc, String arg, boolean instant,
// Call Event
Bukkit.getServer().getPluginManager().callEvent(event);
if ((!event.replaced() && event.getAlternative() != null)
|| (event.getReplaced().equals("null") && event.getAlternative() != null))
|| (event.getReplaced().equals("null") && event.hasAlternative()))
event.setReplaced(event.getAlternative());
if (debug)
dB.echoDebug(scriptEntry, "Filled tag <" + arg.substring(positions[0] + 1, positions[1]) + "> with '" +
Expand Down
Expand Up @@ -41,7 +41,7 @@ public void flagTag(ReplaceableTagEvent event) {
// Replace <FLAG...> TAGs.
String flagName = event.getValue().split(":").length > 1
? event.getValue().split(":")[0].toUpperCase() : event.getValue().toUpperCase();
String flagFallback = event.getAlternative() != null ? event.getAlternative() : "EMPTY";
String flagFallback = event.hasAlternative() ? event.getAlternative() : "EMPTY";
int index = -1;
ReplaceType replaceType = ReplaceType.ASSTRING;

Expand Down

0 comments on commit c68b743

Please sign in to comment.