Skip to content

Commit

Permalink
Add dPlayer.flying mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
Morphan1 committed Mar 29, 2015
1 parent e6bde9d commit 9837ff5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/main/java/net/aufdemrand/denizen/objects/dPlayer.java
Expand Up @@ -1464,7 +1464,7 @@ else if (getPlayerEntity().getFoodLevel() / maxHunger < 1)
// @attribute <p@player.gamemode.id>
// @returns Element(Number)
// @description
// returns the gamemode ID of the player. 0 = survival, 1 = creative, 2 = adventure
// returns the gamemode ID of the player. 0 = survival, 1 = creative, 2 = adventure, 3 = spectator
// -->
if (attribute.startsWith("id"))
return new Element(getPlayerEntity().getGameMode().getValue())
Expand Down Expand Up @@ -1858,13 +1858,26 @@ public void adjust(Mechanism mechanism) {
setFlySpeed(value.asFloat());
}

// <--[mechanism]
// @object dPlayer
// @name flying
// @input Element(Boolean)
// @description
// Sets whether the player is flying.
// @tags
// <p@player.is_flying>
// -->
if (mechanism.matches("flying") && mechanism.requireBoolean()) {
getPlayerEntity().setFlying(value.asBoolean());
}

// <--[mechanism]
// @object dPlayer
// @name gamemode
// @input Element
// @description
// Sets the game mode of the player.
// Valid gamemodes are survival, creative, and adventure.
// Valid gamemodes are survival, creative, adventure, and spectator.
// @tags
// <p@player.gamemode>
// <p@player.gamemode.id>
Expand Down

0 comments on commit 9837ff5

Please sign in to comment.