Plugin format - randomblink/PocketMine-MP GitHub Wiki
PocketMine-MP has a PluginAPI than enables developers to write Plugins for the server. These plugins use PHP as its programming language, and have access to all the API's, or the Server methods itself (not recommended). These plugins are loaded after the server starts.
Field | Description |
---|---|
name | The name of the plugin |
version | Version number |
description | Describes your plugin |
author | The author of the plugin |
class | Class Name that is used to init the Plugin |
apiversion | The api version that works with the plugin (Example: 9 8,9 ) |
You can find the current API version in src/config.php
.
Example: define("CURRENT_API_VERSION", 9);
public function init(){
$this->api->console->register("example", "Example command", array($this, "handleCommand"));
}
public function __destruct(){
}
public function handleCommand($cmd, $arg){
switch($cmd){
case "example":
console("EXAMPLE!!!");
break;
}
}
}
The Main class is used to init the Plugin, and it's specified in the header. The class should implement the Plugin Interface
<a id="example"/>
# Example plugin structure