Skip to content

Commit

Permalink
Add tau, deprecate bad util tags
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 11, 2015
1 parent 32d2c66 commit a6fba86
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions src/main/java/net/aufdemrand/denizen/tags/core/UtilTags.java
Expand Up @@ -964,11 +964,27 @@ else if (subType.equalsIgnoreCase("DUUID"))
.getAttribute(attribute.fulfill(2)));
}

// <--[tag]
// @attribute <util.pi>
// @returns Element
// @description
// Returns PI: 3.141592653589793
// -->
else if (type.equalsIgnoreCase("pi")) {
event.setReplaced(new Element(Math.PI)
.getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <util.tau>
// @returns Element
// @description
// Returns Tau: 6.283185307179586
// -->
else if (type.equalsIgnoreCase("tau")) {
event.setReplaced(new Element(Math.PI * 2)
.getAttribute(attribute.fulfill(1)));
}

else if (type.equalsIgnoreCase("SUBSTR")
|| type.equalsIgnoreCase("TRIM")
Expand Down Expand Up @@ -1018,37 +1034,22 @@ else if (type.equalsIgnoreCase("REPLACE")) {
.getAttribute(attribute.fulfill(3)));
}

// <--[tag]
// @attribute <util.entity_is_spawned[<entity>]>
// @returns Element(Boolean)
// @description
// Returns whether an entity is spawned and valid.
// -->
// TODO: Deprecate in favor of server tag
else if (type.equalsIgnoreCase("ENTITY_IS_SPAWNED")
&& typeContext.length() != 0) {
dEntity ent = dEntity.valueOf(typeContext);
event.setReplaced(new Element((ent != null && ent.isUnique() && ent.isSpawned()) ? "true" : "false")
.getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <util.player_is_valid[<player name>]>
// @returns Element(Boolean)
// @description
// Returns whether a player exists under the specified name.
// -->
// TODO: Deprecate in favor of server tag
else if (type.equalsIgnoreCase("PLAYER_IS_VALID")
&& typeContext.length() != 0) {
event.setReplaced(new Element(dPlayer.playerNameIsValid(typeContext))
.getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <util.npc_is_valid[<npc>]>
// @returns Element(Boolean)
// @description
// Returns whether an NPC exists and is usable.
// -->
// TODO: Deprecate in favor of server tag
else if (type.equalsIgnoreCase("NPC_IS_VALID")
&& typeContext.length() != 0) {
dNPC npc = dNPC.valueOf(typeContext);
Expand Down

0 comments on commit a6fba86

Please sign in to comment.