Skip to content

Advanced Scripts

Nathan Glover edited this page Mar 9, 2018 · 13 revisions

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 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: player-info-example-picture 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 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: server-info-example-picture when the server's MOTD is "A Minecraft Server".

Clone this wiki locally