Skip to content

Commit

Permalink
Add location.skull-name
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 7, 2017
1 parent f4dce27 commit ca6fbab
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions plugin/src/main/java/net/aufdemrand/denizen/objects/dLocation.java
Expand Up @@ -727,19 +727,26 @@ else if (type == Material.TRAP_DOOR
}

// <--[tag]
// @attribute <l@location.skull_skin>
// @attribute <l@location.skull_name>
// @returns Element
// @mechanism dLocation.skull_skin
// @description
// Returns the skin the skull item is displaying - just the name or UUID as text, not a player object.
// Returns the name of the skin the skull item is displaying.
// -->
if (attribute.startsWith("skull_name")) {
BlockState blockState = getBlock().getState();
if (blockState instanceof Skull) {
PlayerProfile profile = NMSHandler.getInstance().getBlockHelper().getPlayerProfile((Skull) blockState);
return new Element(profile.getName()).getAttribute(attribute);
}
}

// <--[tag]
// @attribute <l@location.skull_skin.full>
// @returns Element|Element
// @attribute <l@location.skull_skin>
// @returns Element
// @mechanism dLocation.skull_skin
// @description
// Returns the skin the skull item is displaying - just the name or UUID as text, not a player object,
// along with the permanently cached texture property.
// Returns the skin the skull item is displaying - just the name or UUID as text, not a player object.
// -->
if (attribute.startsWith("skull_skin")) {
BlockState blockState = getBlock().getState();
Expand All @@ -749,6 +756,14 @@ else if (type == Material.TRAP_DOOR
UUID uuid = profile.getUniqueId();
String texture = profile.getTexture();
attribute = attribute.fulfill(1);
// <--[tag]
// @attribute <l@location.skull_skin.full>
// @returns Element|Element
// @mechanism dLocation.skull_skin
// @description
// Returns the skin the skull item is displaying - just the name or UUID as text, not a player object,
// along with the permanently cached texture property.
// -->
if (attribute.startsWith("full")) {
return new Element((uuid != null ? uuid : name != null ? name : null)
+ (texture != null ? "|" + texture : ""))
Expand Down

0 comments on commit ca6fbab

Please sign in to comment.