mirror of
https://github.com/PlaceholderAPI/Javascript-Expansion.git
synced 2025-05-23 18:42:44 +00:00
Added server information
parent
aaecfcb0a6
commit
ef57812742
@ -1,6 +1,6 @@
|
||||
## 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.
|
||||
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.
|
||||
|
||||
@ -17,4 +17,24 @@ function playerNameHealth() {
|
||||
playerNameHealth();
|
||||
```
|
||||
|
||||
Produces:  when ran.
|
||||
Produces:  when ran.
|
||||
|
||||
## Server Information
|
||||
|
||||
Just like the player, the server is also passed along to the placeholder script when called. The server may be accessed using `BukkitServer`. After receiving, you can access all of the [server methods](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Server.html) included in the Spigot API.
|
||||
|
||||
Here is an example that will display the Server's MOTD through a placeholder.
|
||||
|
||||
```Javascript
|
||||
var server = BukkitServer;
|
||||
|
||||
function getMotd() {
|
||||
var motd = server.getMotd();
|
||||
|
||||
return motd;
|
||||
}
|
||||
|
||||
getMotd();
|
||||
```
|
||||
|
||||
Produces:  when the server's MOTD is "A Minecraft Server".
|
Loading…
x
Reference in New Issue
Block a user