Skip to content

Commit

Permalink
Add <server.current_time_millis>.
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed Jul 26, 2013
1 parent 41ea5ea commit 09d682f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/main/java/net/aufdemrand/denizen/tags/core/UtilTags.java
Expand Up @@ -48,7 +48,7 @@ public void queueTags(ReplaceableTagEvent event) {

if (attribute.startsWith("id"))
event.setReplaced(new Element(event.getScriptEntry().getResidingQueue().id)
.getAttribute(attribute.fulfill(1)));
.getAttribute(attribute.fulfill(1)));

if (attribute.startsWith("stats"))
event.setReplaced(new Element(ScriptQueue._getStats())
Expand Down Expand Up @@ -99,14 +99,26 @@ public void serverTags(ReplaceableTagEvent event) {
return;
}

// <--
// <server.current_time_millis> -> Element(number)
// returns the number of milliseconds since Jan 1, 1970.
// -->
if (attribute.startsWith("current_time_millis")) {
event.setReplaced(new Element(String.valueOf(System.currentTimeMillis()))
.getAttribute(attribute.fulfill(1)));
}

// server.selected_npc
if (attribute.startsWith("selected_npc")) {
event.setReplaced(new dNPC(((Citizens) Bukkit.getPluginManager().getPlugin("Citizens"))
.getNPCSelector().getSelected(Bukkit.getConsoleSender())).getAttribute(attribute.fulfill(1)));
return;
}

// server.list_npcs
// <--
// <server.current_time_millis> -> dList(dNPC)
// returns a dList of dNPCs currently in the Citizens NPC Registry.
// -->
if (attribute.startsWith("list_npcs")) {
ArrayList<dNPC> npcs = new ArrayList<dNPC>();
for (NPC npc : CitizensAPI.getNPCRegistry())
Expand All @@ -115,7 +127,10 @@ public void serverTags(ReplaceableTagEvent event) {
return;
}

// server.list_worlds
// <--
// <server.current_time_millis> -> dList(dNPC)
// returns a dList of dNPCs currently in the Citizens NPC Registry.
// -->
if (attribute.startsWith("list_worlds")) {
ArrayList<dWorld> worlds = new ArrayList<dWorld>();
for (World world : Bukkit.getWorlds())
Expand Down

0 comments on commit 09d682f

Please sign in to comment.