Skip to content

Commit

Permalink
Clean some more tag meta
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Sep 26, 2013
1 parent e7bdacc commit 8831c6a
Showing 1 changed file with 8 additions and 25 deletions.
33 changes: 8 additions & 25 deletions src/main/java/net/aufdemrand/denizen/tags/core/UtilTags.java
Expand Up @@ -55,13 +55,6 @@ public void mathTags(ReplaceableTagEvent event) {
@EventHandler
public void queueTags(ReplaceableTagEvent event) {

// <--[tag]
// @attribute <q>
// @returns Queuestat
// @description
// Returns "q" (or "queue" if you spell it out)... Pretty useless by itself.
// [See <q.id>, <q.stats>, <q.size>, and <q.definitions>]
// -->
if (!event.matches("queue, q")) return;
Attribute attribute =
new Attribute(event.raw_tag, event.getScriptEntry()).fulfill(1);
Expand Down Expand Up @@ -118,7 +111,7 @@ public void serverTags(ReplaceableTagEvent event) {
// @attribute <server.flag[<name>]>
// @returns Flag dList
// @description
// Returns a "Flag dList" of the server flag specified.
// returns the specified flag from the server.
// -->
if (attribute.startsWith("flag")) {
String flag_name;
Expand All @@ -128,26 +121,12 @@ public void serverTags(ReplaceableTagEvent event) {
return;
}
attribute.fulfill(1);

// <--[tag]
// @attribute <server.flag[<name>].is_expired>
// @returns Element(Boolean)
// @description
// Returns true if the flag specified is expired. Else, returns false.
// -->
if (attribute.startsWith("is_expired")
|| attribute.startsWith("isexpired")) {
event.setReplaced(new Element(!FlagManager.serverHasFlag(flag_name))
.getAttribute(attribute.fulfill(1)));
return;
}

// <--[tag]
// @attribute <server.flag[<name>].size>
// @returns Element(Number)
// @description
// Returns the size of the Flag dList. If the flag doesn't exist, returns 0.
// -->
if (attribute.startsWith("size") && !FlagManager.serverHasFlag(flag_name)) {
event.setReplaced(new Element(0).getAttribute(attribute.fulfill(1)));
return;
Expand Down Expand Up @@ -187,7 +166,7 @@ public void serverTags(ReplaceableTagEvent event) {
// @attribute <server.get_npcs_named[<name>]>
// @returns dList(dNPC)
// @description
// Returns a dList of dNPCs with a certain name.
// Returns a list of NPCs with a certain name.
// -->
if (attribute.startsWith("get_npcs_named") && attribute.hasContext(1)) {
ArrayList<dNPC> npcs = new ArrayList<dNPC>();
Expand All @@ -202,7 +181,7 @@ public void serverTags(ReplaceableTagEvent event) {
// @attribute <server.list_npcs>
// @returns dList(dNPC)
// @description
// Returns a dList of dNPCs currently in the Citizens NPC Registry.
// Returns a list of all NPCs.
// -->
if (attribute.startsWith("list_npcs")) {
ArrayList<dNPC> npcs = new ArrayList<dNPC>();
Expand All @@ -216,7 +195,7 @@ public void serverTags(ReplaceableTagEvent event) {
// @attribute <server.list_worlds>
// @returns dList(dWorld)
// @description
// Returns a dList of all worlds.
// Returns a list of all worlds.
// -->
if (attribute.startsWith("list_worlds")) {
ArrayList<dWorld> worlds = new ArrayList<dWorld>();
Expand Down Expand Up @@ -393,6 +372,7 @@ else if (type.equalsIgnoreCase("SUBSTR")
// @returns Element
// @description
// Returns all text in text1 after the first occurrence of text2.
// (Deprecated in favor of <el@element.after[<text>]>)
// -->
if (subType.equalsIgnoreCase("AFTER")) {
from = text.toUpperCase().indexOf(subTypeContext) + subTypeContext.length() + 1;
Expand All @@ -403,6 +383,7 @@ else if (type.equalsIgnoreCase("SUBSTR")
// @returns Element
// @description
// Returns all text in text1 before the first occurrence of text2.
// (Deprecated in favor of <element.before[<text>]>)
// -->
if (subType.equalsIgnoreCase("BEFORE")) {
to = text.toUpperCase().indexOf(subTypeContext) + 1;
Expand All @@ -413,6 +394,7 @@ else if (type.equalsIgnoreCase("SUBSTR")
// @returns Element
// @description
// Returns all text in between the 2 points in the text.
// (Deprecated in favor of <element.substring[<#>(,<#>)]>)
// -->
try {
if (subType.equalsIgnoreCase("FROM"))
Expand All @@ -438,6 +420,7 @@ else if (type.equalsIgnoreCase("SUBSTR")
// @returns Element
// @description
// Returns the text with all instances of fromText replaced as toText.
// (Deprecated in favor of <el@element.replace[<text>].with[<text>]>)
// -->
else if (type.equalsIgnoreCase("REPLACE")) {
String item_to_replace = event.getTypeContext();
Expand Down

0 comments on commit 8831c6a

Please sign in to comment.