Plugin: PlayerStuff
Let’s play around with a Player a bit more.
We’re going to install the PlayerStuff plugin and change some of the object properties for players in the Minecraft world.
In the Player object, there are all kinds of interesting functions to get information about a player, and to set those values as well. Here are a few we’ll look at:
chat() |
getWorld() |
getDisplayName() (can set it too) |
getExperience() (can set it too) |
getHunger() (can set it too) |
getHealth() (can set it too) |
isSleeping() |
getLocation() |
We can send a message to a player, get some values, and more. Here’s code for a full plugin that demonstrates some of these features. It provides the command "/whoami". For more advanced plugins, this approach could be a great ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access