Skip to content

Commit

Permalink
Fix utiltags
Browse files Browse the repository at this point in the history
This code is a wreck and needs a complete rewrite... here's a temporary
patch
  • Loading branch information
mcmonkey4eva committed Jan 14, 2015
1 parent 1d45a41 commit 23920b9
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/main/java/net/aufdemrand/denizen/tags/core/UtilTags.java
Expand Up @@ -942,9 +942,9 @@ else if (type.equalsIgnoreCase("SUBSTR")

// TODO: Delete (Deprecated in favor of el@element.replace)
else if (type.equalsIgnoreCase("REPLACE")) {
String item_to_replace = event.getTypeContext();
String replace = event.getSubTypeContext();
String replacement = event.getSpecifierContext();
String item_to_replace = type;
String replace = typeContext;
String replacement = specifierContext;
event.setReplaced(new Element(item_to_replace.replace(replace, replacement))
.getAttribute(attribute.fulfill(3)));
}
Expand All @@ -956,8 +956,8 @@ else if (type.equalsIgnoreCase("REPLACE")) {
// Returns whether an entity is spawned and valid.
// -->
else if (type.equalsIgnoreCase("ENTITY_IS_SPAWNED")
&& event.hasTypeContext()) {
dEntity ent = dEntity.valueOf(event.getTypeContext());
&& typeContext.length() != 0) {
dEntity ent = dEntity.valueOf(typeContext);
event.setReplaced(new Element((ent != null && ent.isUnique() && ent.isSpawned()) ? "true" : "false")
.getAttribute(attribute.fulfill(1)));
}
Expand All @@ -969,8 +969,8 @@ else if (type.equalsIgnoreCase("ENTITY_IS_SPAWNED")
// Returns whether a player exists under the specified name.
// -->
else if (type.equalsIgnoreCase("PLAYER_IS_VALID")
&& event.hasTypeContext()) {
event.setReplaced(new Element(dPlayer.playerNameIsValid(event.getTypeContext()))
&& typeContext.length() != 0) {
event.setReplaced(new Element(dPlayer.playerNameIsValid(typeContext))
.getAttribute(attribute.fulfill(1)));
}

Expand All @@ -981,23 +981,23 @@ else if (type.equalsIgnoreCase("PLAYER_IS_VALID")
// Returns whether an NPC exists and is usable.
// -->
else if (type.equalsIgnoreCase("NPC_IS_VALID")
&& event.hasTypeContext()) {
dNPC npc = dNPC.valueOf(event.getTypeContext());
&& typeContext.length() != 0) {
dNPC npc = dNPC.valueOf(typeContext);
event.setReplaced(new Element((npc != null && npc.isValid()))
.getAttribute(attribute.fulfill(1)));
}


// TODO: Delete (Deprecated in favor of el@element.to_uppercase)
else if (type.equalsIgnoreCase("UPPERCASE")) {
String item_to_uppercase = event.getTypeContext();
String item_to_uppercase = typeContext;
event.setReplaced(new Element(item_to_uppercase.toUpperCase())
.getAttribute(attribute.fulfill(1)));
}

// TODO: Delete (Deprecated in favor of el@element.to_lowercase)
else if (type.equalsIgnoreCase("LOWERCASE")) {
String item_to_uppercase = event.getTypeContext();
String item_to_uppercase = typeContext;
event.setReplaced(new Element(item_to_uppercase.toLowerCase())
.getAttribute(attribute.fulfill(1)));
}
Expand Down Expand Up @@ -1104,11 +1104,11 @@ else if (specifier.equalsIgnoreCase("duration"))
// -->
else if (subType.equalsIgnoreCase("FORMAT") && !subTypeContext.equalsIgnoreCase("")) {
try {
format.applyPattern(event.getSubTypeContext());
format.applyPattern(subTypeContext);
event.setReplaced(format.format(currentDate));
}
catch (Exception ex) {
dB.echoError("Error: invalid pattern '" + event.getSubTypeContext() + "'");
dB.echoError("Error: invalid pattern '" + subTypeContext + "'");
dB.echoError(ex);
}
}
Expand Down

0 comments on commit 23920b9

Please sign in to comment.