-
Notifications
You must be signed in to change notification settings - Fork 22
Advanced Scripts
Nathan Glover edited this page Mar 9, 2018
·
13 revisions
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 included in the Spigot API.
Here is an example that will return the player's name and their health.
var player = BukkitPlayer;
function playerNameHealth() {
var name = player.getDisplayName();
var health = player.getHealth();
return name + " has " + health + " health!";
}
playerNameHealth();
Produces: when ran.
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 included in the Spigot API.
Here is an example that will display the Server's MOTD through a placeholder.
var server = BukkitServer;
function getMotd() {
var motd = server.getMotd();
return motd;
}
getMotd();
Produces: when the server's MOTD is "A Minecraft Server".