The API class contains methods for basic plugin functionality, such as handling events, registering commands, and more.
Most methods aren’t related to gameplay, aside from commands, but for core stuff. See the Minecraft class (accessible at self.api.minecraft) for more gameplay-related methods.
Invokes the specific event. Payload is extra information relating to the event. Errors may occur if you don’t specify the right payload information.
Returns the content of another plugin with the specified ID.
i.e. api.getPluginContext(“com.benbaptist.plugins.essentials”)
Return a storage object for storing configurations, player data, and any other data your plugin will need to remember across reboots.
Setting world=True will store the data inside the current world folder, for world-specific data.
This registers a command that, when executed in Minecraft, will execute callback(player, args). permission is an optional attribute if you want your command to only be executable if the player has a specified permission node.
Register an event and a callback. See [doc link needed here] for a list of events. callback(payload) when an event occurs, and the contents of payload varies between events.
Used to set a default for a specific permission node.
Note: You do not need to run this function unless you want certain permission nodes to be granted by default. i.e. essentials.list should be on by default, so players can run /list without having any permissions.
This class contains functions related to in-game features directly. These methods are located at self.api.minecraft.
Broadcasts the specified message to all clients connected. message can be a JSON chat object, or a string with formatting codes using the & as a prefix.
Setting irc=True will also broadcast the specified message on IRC channels that Wrapper.py is connected to. Formatting might not work properly.
Returns the player object of the specified logged-in player. Will raise an exception if the player is not logged in.
Gives the specified status effect to the specified target.
Returns the username from the specified UUID. If the player has never logged in before and isn’t in the user cache, it will poll Mojang’s API. The function will raise an exception if the UUID is invalid.
THIS METHOD WILL BE CHANGED. Used to message some specific target.
Used internally to process old-style color-codes with the & symbol, and returns a JSON chat object.
Sets a block at the specified coordinates with the specific details. Will fail if the chunk is not loaded.
Player objects contains methods and data of a currently logged-in player. This object is destroyed upon logging off.
Upon calling, the player object will become defunct and the client will be transferred to another server (provided it has offline-mode turned on).
Returns the player’s current dimension. -1 for Nether, 0 for Overworld, and 1 for End.
Returns a tuple containing the timestamp of when the user first logged in for the first time, and the timezone (same as time.tzname).
Returns a boolean of whether or not the player is in the specified permission group.
If the player has the specified permission node (either directly, or inherited from a group that the player is in), it will return the value (usually True) of the node. Otherwise, it returns False.
Used internally to process old-style color-codes with the & symbol, and returns a JSON chat object.