Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
location.sign_contents
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 29, 2017
1 parent c25e943 commit 98795a4
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,28 @@ public UtilLocation getInternal() {
return new LocationTag(loc.x * scalar, loc.y * scalar, loc.z * scalar, loc.world);
});
// <--[tag]
// @Name LocationTag.sign_contents
// @Updated 2017/01/29
// @Group World Data
// @ReturnType ListTag
// @Returns a list of all text on the sign at this location.
// @Example "0,2,0,world" .sign_contents might return "First Line||Third Line|".
// -->
handlers.put("sign_contents", (dat, obj) -> {
Optional<List<Text>> contents = ((LocationTag) obj).internal.toLocation().get(Keys.SIGN_LINES);
if (!contents.isPresent()) {
if (!dat.hasFallback()) {
dat.error.run("No sign contents present for this location!");
}
return new NullTag();
}
ListTag list = new ListTag();
for (Text t : contents.get()) {
list.getInternal().add(new FormattedTextTag(t));
}
return list;
});
// <--[tag]
// @Name LocationTag.data
// @Updated 2016/08/28
// @Group World Data
Expand Down

0 comments on commit 98795a4

Please sign in to comment.