Added server information

Nathan Glover 2018-03-08 19:24:41 -05:00
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: ![example](https://i.imgur.com/GR1nqdE.png) when ran.
Produces: ![player-info-example-picture](https://i.imgur.com/GR1nqdE.png) 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: ![server-info-example-picture](https://i.imgur.com/6yxjpsV.png) when the server's MOTD is "A Minecraft Server".