diff --git a/Advanced-Scripts.md b/Advanced-Scripts.md new file mode 100644 index 0000000..fdec778 --- /dev/null +++ b/Advanced-Scripts.md @@ -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. \ No newline at end of file