Skip to content

Commit

Permalink
add worldborder tags
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackCoyote committed Feb 12, 2017
1 parent 11d5fdb commit 8981424
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions plugin/src/main/java/net/aufdemrand/denizen/objects/dWorld.java
Expand Up @@ -801,6 +801,94 @@ public String run(Attribute attribute, dObject object) {
}
});

/////////////////////
// WORLD BORDER ATTRIBUTES
/////////////////

// <--[tag]
// @attribute <w@world.border_size>
// @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 <w@world.border_center>
// @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 <w@world.border_damage>
// @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 <w@world.border_damage_buffer>
// @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 <w@world.border_warning_distance>
// @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 <w@world.border_warning_time>
// @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<String, TagRunnable> registeredTags = new HashMap<String, TagRunnable>();
Expand Down

0 comments on commit 8981424

Please sign in to comment.