mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17:07 +00:00
Implemented Plugin Interface
This commit is contained in:
parent
00fea6461c
commit
987a6e635e
@ -161,3 +161,10 @@ class PluginAPI extends stdClass{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface Plugin{
|
||||
public function __construct($api, $server = false);
|
||||
public function init();
|
||||
public function __destruct();
|
||||
}
|
@ -9,7 +9,7 @@ class=ExamplePlugin
|
||||
*/
|
||||
|
||||
|
||||
class ExamplePlugin{
|
||||
class ExamplePlugin implements Plugin{
|
||||
private $api;
|
||||
public function __construct($api, $server = false){
|
||||
$this->api = $api;
|
||||
@ -19,6 +19,10 @@ class ExamplePlugin{
|
||||
$this->api->console->register("example", "Example command", array($this, "handleCommand"));
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
|
||||
}
|
||||
|
||||
public function handleCommand($cmd, $arg){
|
||||
switch($cmd){
|
||||
case "example":
|
||||
|
@ -10,7 +10,7 @@ class=ReactorAsWater
|
||||
*/
|
||||
|
||||
|
||||
class ReactorAsWater{
|
||||
class ReactorAsWater implements Plugin{
|
||||
private $api;
|
||||
public function __construct($api, $server = false){
|
||||
$this->api = $api;
|
||||
@ -21,6 +21,9 @@ class ReactorAsWater{
|
||||
$this->api->addHandler("player.equipment.change", array($this, "handle"), 15);
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
|
||||
}
|
||||
|
||||
public function handle(&$data, $event){
|
||||
switch($event){
|
||||
|
@ -10,7 +10,7 @@ class=SpawnChanger
|
||||
*/
|
||||
|
||||
|
||||
class SpawnChanger{
|
||||
class SpawnChanger implements Plugin{
|
||||
private $api, $config, $path;
|
||||
public function __construct($api, $server = false){
|
||||
$this->api = $api;
|
||||
@ -37,6 +37,10 @@ class SpawnChanger{
|
||||
$this->api->console->register("spawn", "Teleports to spawn", array($this, "command"));
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
|
||||
}
|
||||
|
||||
public function command($cmd, $args){
|
||||
switch($cmd){
|
||||
case "spawnchanger":
|
||||
|
Loading…
x
Reference in New Issue
Block a user