Added Player Information

Nathan Glover 2018-03-08 19:12:01 -05:00
parent 26600da442
commit bb734cdfbc

20
Advanced-Scripts.md Normal file

@ -0,0 +1,20 @@
## Player Information
When a placeholder script is called, the player that is passed to the Javascript-Expansion is also passed to the placeholder script. This player can be accessed with `BukkitPlayer`. After receiving, you can access [all of the player methods](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html) included in the Spigot API.
Here is an example that will return the player's name and their health.
```javascript
var player = BukkitPlayer;
function playerNameHealth() {
var name = player.getDisplayName();
var health = player.getHealth();
return name + " has " + health + " health!";
}
playerNameHealth();
```
Produces: ![example](https://i.imgur.com/GR1nqdE.png) when ran.