From 8981424604439314394929565e825b30ce02f26e Mon Sep 17 00:00:00 2001 From: BlackCoyote Date: Mon, 13 Feb 2017 00:55:19 +0100 Subject: [PATCH] add worldborder tags --- .../aufdemrand/denizen/objects/dWorld.java | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/plugin/src/main/java/net/aufdemrand/denizen/objects/dWorld.java b/plugin/src/main/java/net/aufdemrand/denizen/objects/dWorld.java index dd5f02171e..2ef4e2916f 100644 --- a/plugin/src/main/java/net/aufdemrand/denizen/objects/dWorld.java +++ b/plugin/src/main/java/net/aufdemrand/denizen/objects/dWorld.java @@ -801,6 +801,94 @@ public String run(Attribute attribute, dObject object) { } }); + ///////////////////// + // WORLD BORDER ATTRIBUTES + ///////////////// + + // <--[tag] + // @attribute + // @returns Element + // @description + // returns the size of the world border in this world. + // --> + registerTag("border_size", new TagRunnable() { + @Override + public String run(Attribute attribute, dObject object) { + return new Element(((dWorld) object).getWorld().getWorldBorder().getSize()) + .getAttribute(attribute.fulfill(1)); + } + }); + + // <--[tag] + // @attribute + // @returns dLocation + // @description + // returns the center of the world border in this world. + // --> + registerTag("border_center", new TagRunnable() { + @Override + public String run(Attribute attribute, dObject object) { + return new dLocation(((dWorld) object).getWorld().getWorldBorder().getCenter()) + .getAttribute(attribute.fulfill(1)); + } + }); + + // <--[tag] + // @attribute + // @returns Element + // @description + // returns the size of the world border in this world. + // --> + registerTag("border_damage", new TagRunnable() { + @Override + public String run(Attribute attribute, dObject object) { + return new Element(((dWorld) object).getWorld().getWorldBorder().getDamageAmount()) + .getAttribute(attribute.fulfill(1)); + } + }); + + // <--[tag] + // @attribute + // @returns Element + // @description + // returns the damage buffer of the world border in this world. + // --> + registerTag("border_damage_buffer", new TagRunnable() { + @Override + public String run(Attribute attribute, dObject object) { + return new Element (((dWorld) object).getWorld().getWorldBorder().getDamageBuffer()) + .getAttribute(attribute.fulfill(1)); + } + }); + + // <--[tag] + // @attribute + // @returns Element + // @description + // returns the warning distance of the world border in this world. + // --> + registerTag("border_warning_distance", new TagRunnable() { + @Override + public String run(Attribute attribute, dObject object) { + return new Element(((dWorld) object).getWorld().getWorldBorder().getWarningDistance()) + .getAttribute(attribute.fulfill(1)); + } + }); + + // <--[tag] + // @attribute + // @returns Duration + // @description + // returns warning time of the world border in this world as a duration. + // --> + registerTag("border_warning_time", new TagRunnable() { + @Override + public String run(Attribute attribute, dObject object) { + return new Duration(((dWorld) object).getWorld().getWorldBorder().getWarningTime()) + .getAttribute(attribute.fulfill(1)); + } + }); + } public static HashMap registeredTags = new HashMap();