From c5d2093f15328c276c4340d58b4212e2484df60c Mon Sep 17 00:00:00 2001 From: Jeremy Schroeder Date: Mon, 22 Jul 2013 00:58:05 -0400 Subject: [PATCH] Document 'duration' tags. --- .../aufdemrand/denizen/objects/Duration.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/net/aufdemrand/denizen/objects/Duration.java b/src/main/java/net/aufdemrand/denizen/objects/Duration.java index 341ae6f1b8..09caac7bbf 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/Duration.java +++ b/src/main/java/net/aufdemrand/denizen/objects/Duration.java @@ -279,18 +279,34 @@ public String getAttribute(Attribute attribute) { if (attribute == null) return null; + // <-- + // -> Element(number) + // returns the number of seconds in the Duration. + // --> if (attribute.startsWith("in_seconds")) return new Element(String.valueOf(seconds)) .getAttribute(attribute.fulfill(1)); + // <-- + // -> Element(number) + // returns the number of hours in the Duration. + // --> if (attribute.startsWith("in_hours")) return new Element(String.valueOf(seconds / 1800)) .getAttribute(attribute.fulfill(1)); + // <-- + // -> Element(number) + // returns the number of minutes in the Duration. + // --> if (attribute.startsWith("in_minutes")) return new Element(String.valueOf(seconds / 60)) .getAttribute(attribute.fulfill(1)); + // <-- + // -> Element(number) + // returns the number of ticks in the Duration. (20t/second) + // --> if (attribute.startsWith("in_ticks")) return new Element(String.valueOf(getTicksAsInt())) .getAttribute(attribute.fulfill(1)); @@ -315,6 +331,11 @@ public String getAttribute(Attribute attribute) { .getAttribute(attribute.fulfill(1)); } + // <-- + // -> Element + // returns the value of the duration, in the best format + // possible. + // --> if (attribute.startsWith("value")) { if (seconds % 43200 == 0) return new Element(seconds / 86400 + "d")