mirror of
https://github.com/PlaceholderAPI/Javascript-Expansion.git
synced 2025-05-24 20:02:44 +00:00
Added Player Information
parent
26600da442
commit
bb734cdfbc
20
Advanced-Scripts.md
Normal file
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:  when ran.
|
Loading…
x
Reference in New Issue
Block a user