Skip to content

Commit

Permalink
Better meta docs
Browse files Browse the repository at this point in the history
dCuboid tag info, player online/offline info
  • Loading branch information
mcmonkey4eva committed Oct 18, 2014
1 parent 9cba9fd commit f9c734e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/main/java/net/aufdemrand/denizen/objects/dCuboid.java
Expand Up @@ -645,6 +645,8 @@ public String getAttribute(Attribute attribute) {
// @returns dList(dLocation)
// @description
// Returns each block location within the dCuboid.
// Optionally, specify a list of materials to only return locations
// with that block type.
// -->
if (attribute.startsWith("get_blocks")) {
if (attribute.hasContext(1))
Expand Down Expand Up @@ -682,11 +684,13 @@ public String getAttribute(Attribute attribute) {
}

// <--[tag]
// @attribute <cu@cuboid.get_spawnable_blocks>
// @attribute <cu@cuboid.get_spawnable_blocks[<Material>|...]>
// @returns dList(dLocation)
// @description
// Returns each dLocation within the dCuboid that is
// safe for players or similar entities to spawn in.
// Optionally, specify a list of materials to only return locations
// with that block type.
// -->
if (attribute.startsWith("get_spawnable_blocks")) {
if (attribute.hasContext(1))
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/net/aufdemrand/denizen/objects/dEntity.java
Expand Up @@ -1194,6 +1194,7 @@ public String getAttribute(Attribute attribute) {
// @group data
// @description
// Returns the permanent unique ID of the entity.
// Works with offline players.
// -->
if (attribute.startsWith("uuid"))
return new Element(getUUID().toString())
Expand Down Expand Up @@ -1273,6 +1274,7 @@ public String getAttribute(Attribute attribute) {
// @description
// Returns the name of the entity.
// This can be a player name, an NPC name, a custom_name, or the entity type.
// Works with offline players.
// -->
if (attribute.startsWith("name")) {
return new Element(getName()).getAttribute(attribute.fulfill(1));
Expand Down Expand Up @@ -1438,6 +1440,7 @@ else if (attribute.startsWith("equipment")) {
// @group location
// @description
// Returns the location of what the entity is standing on.
// Works with offline players.
// -->
if (attribute.startsWith("location.standing_on"))
return new dLocation(entity.getLocation().clone().add(0, -0.5f, 0))
Expand All @@ -1449,6 +1452,7 @@ else if (attribute.startsWith("equipment")) {
// @group location
// @description
// Returns the location of the entity.
// Works with offline players.
// -->
if (attribute.startsWith("location")) {
return new dLocation(entity.getLocation())
Expand Down Expand Up @@ -1801,6 +1805,7 @@ else if ((float) getLivingEntity().getHealth() / maxHealth < 1)
// @group attributes
// @description
// Returns the maximum duration of oxygen the entity can have.
// Works with offline players.
// -->
if (attribute.startsWith("oxygen.max"))
return new Duration((long) getLivingEntity().getMaximumAir())
Expand All @@ -1812,6 +1817,7 @@ else if ((float) getLivingEntity().getHealth() / maxHealth < 1)
// @group attributes
// @description
// Returns the duration of oxygen the entity has left.
// Works with offline players.
// -->
if (attribute.startsWith("oxygen"))
return new Duration((long) getLivingEntity().getRemainingAir())
Expand Down Expand Up @@ -1887,6 +1893,7 @@ else if ((float) getLivingEntity().getHealth() / maxHealth < 1)
// @group data
// @description
// Returns whether the entity is a player.
// Works with offline players.
// -->
if (attribute.startsWith("is_player")) {
return new Element(isPlayer())
Expand Down
25 changes: 23 additions & 2 deletions src/main/java/net/aufdemrand/denizen/objects/dPlayer.java
Expand Up @@ -471,6 +471,7 @@ public String getAttribute(Attribute attribute) {
// @returns Element(Boolean)
// @description
// Debugs the player in the log and returns true.
// Works with offline players.
// -->
if (attribute.startsWith("debug.log")) {
dB.log(debug());
Expand All @@ -483,6 +484,7 @@ public String getAttribute(Attribute attribute) {
// @returns Element
// @description
// Returns the player's debug with no color.
// Works with offline players.
// -->
if (attribute.startsWith("debug.no_color")) {
return new Element(ChatColor.stripColor(debug()))
Expand All @@ -494,6 +496,7 @@ public String getAttribute(Attribute attribute) {
// @returns Element
// @description
// Returns the player's debug.
// Works with offline players.
// -->
if (attribute.startsWith("debug")) {
return new Element(debug())
Expand All @@ -505,6 +508,7 @@ public String getAttribute(Attribute attribute) {
// @returns Element
// @description
// Returns the dObject's prefix.
// Works with offline players.
// -->
if (attribute.startsWith("prefix"))
return new Element(prefix)
Expand All @@ -521,6 +525,7 @@ public String getAttribute(Attribute attribute) {
// @description
// Returns a list of the last 10 things the player has said, less
// if the player hasn't said all that much.
// Works with offline players.
// -->
if (attribute.startsWith("chat_history_list"))
return new dList(PlayerTags.playerChatHistory.get(getName())) // TODO: UUID?
Expand All @@ -532,6 +537,7 @@ public String getAttribute(Attribute attribute) {
// @description
// returns the last thing the player said.
// If a number is specified, returns an earlier thing the player said.
// Works with offline players.
// -->
if (attribute.startsWith("chat_history")) {
int x = 1;
Expand All @@ -550,6 +556,7 @@ public String getAttribute(Attribute attribute) {
// @returns Flag dList
// @description
// returns the specified flag from the player.
// Works with offline players.
// -->
if (attribute.startsWith("flag")) {
String flag_name;
Expand All @@ -573,6 +580,7 @@ public String getAttribute(Attribute attribute) {
// @returns Element(Boolean)
// @description
// returns true if the Player has the specified flag, otherwise returns false.
// Works with offline players.
// -->
if (attribute.startsWith("has_flag")) {
String flag_name;
Expand All @@ -587,6 +595,7 @@ public String getAttribute(Attribute attribute) {
// @description
// Returns a list of a player's flag names, with an optional search for
// names containing a certain pattern.
// Works with offline players.
// -->
if (attribute.startsWith("list_flags")) {
dList allFlags = new dList(DenizenAPI.getCurrentInstance().flagManager().listPlayerFlags(this));
Expand Down Expand Up @@ -625,6 +634,7 @@ public String getAttribute(Attribute attribute) {
// @returns Element(Decimal)
// @description
// returns the amount of money the player has with the registered Economy system.
// May work offline depending on economy plugin.
// -->

if (attribute.startsWith("money")) {
Expand Down Expand Up @@ -837,6 +847,7 @@ else if (attribute.startsWith("uuid") && !isOnline())
// @returns Element
// @description
// returns the ID used to save the player in Denizen's saves.yml file.
// Works with offline players.
// -->
if (attribute.startsWith("save_name"))
return new Element(getSaveName()).getAttribute(attribute.fulfill(1));
Expand All @@ -852,6 +863,7 @@ else if (attribute.startsWith("uuid") && !isOnline())
// @description
// Returns the location of the player's bed spawn location, 'null' if
// it doesn't exist.
// Works with offline players.
// -->
if (attribute.startsWith("bed_spawn"))
return new dLocation(getOfflinePlayer().getBedSpawnLocation())
Expand All @@ -874,6 +886,7 @@ else if (attribute.startsWith("uuid") && !isOnline())
// @returns Duration
// @description
// returns the millisecond time of when the player first logged on to this server.
// Works with offline players.
// -->
if (attribute.startsWith("first_played")) {
attribute = attribute.fulfill(1);
Expand All @@ -890,6 +903,8 @@ else if (attribute.startsWith("uuid") && !isOnline())
// @returns Element(Boolean)
// @description
// returns whether the player has played before.
// Works with offline players.
// Note: This will just always return true.
// -->
if (attribute.startsWith("has_played_before"))
return new Element(true)
Expand Down Expand Up @@ -937,6 +952,7 @@ else if (attribute.startsWith("uuid") && !isOnline())
// @returns Element(Boolean)
// @description
// returns whether the player is currently online.
// Works with offline players (returns false in that case).
// -->
if (attribute.startsWith("is_online"))
return new Element(isOnline()).getAttribute(attribute.fulfill(1));
Expand All @@ -946,6 +962,7 @@ else if (attribute.startsWith("uuid") && !isOnline())
// @returns Element(Boolean)
// @description
// returns whether the player is a full server operator.
// Works with offline players.
// -->
if (attribute.startsWith("is_op"))
return new Element(getOfflinePlayer().isOp())
Expand All @@ -956,6 +973,7 @@ else if (attribute.startsWith("uuid") && !isOnline())
// @returns Element(Boolean)
// @description
// returns whether the player is whitelisted.
// Works with offline players.
// -->
if (attribute.startsWith("is_whitelisted"))
return new Element(getOfflinePlayer().isWhitelisted())
Expand All @@ -965,8 +983,8 @@ else if (attribute.startsWith("uuid") && !isOnline())
// @attribute <p@player.last_played>
// @returns Duration
// @description
// returns the millisecond time of when the player
// was last seen.
// returns the millisecond time of when the player was last seen.
// Works with offline players.
// -->
if (attribute.startsWith("last_played")) {
attribute = attribute.fulfill(1);
Expand All @@ -983,6 +1001,7 @@ else if (attribute.startsWith("uuid") && !isOnline())
// @returns dList
// @description
// returns a list of all groups the player is in.
// May work with offline players, depending on permission plugin.
// -->
if (attribute.startsWith("groups")) {
if (Depends.permissions == null) {
Expand Down Expand Up @@ -1109,6 +1128,7 @@ else if (isOnline())
// @returns dInventory
// @description
// returns a dInventory of the player's current inventory.
// Works with offline players.
// -->
if (attribute.startsWith("inventory")) {
return getInventory().getAttribute(attribute.fulfill(1));
Expand All @@ -1119,6 +1139,7 @@ else if (isOnline())
// @returns dInventory
// @description
// Gets the player's enderchest inventory.
// Works with offline players.
// -->
if (attribute.startsWith("enderchest"))
return getEnderChest().getAttribute(attribute.fulfill(1));
Expand Down

0 comments on commit f9c734e

Please sign in to comment.