mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Posibility of changing data for handlers, and canceling it
This commit is contained in:
@ -39,9 +39,9 @@ class BlockAPI{
|
||||
}
|
||||
|
||||
public function init(){
|
||||
$this->server->addHandler("world.block.update", array($this, "updateBlockRemote"));
|
||||
$this->server->addHandler("player.block.break", array($this, "blockBreak"));
|
||||
$this->server->addHandler("player.block.action", array($this, "blockAction"));
|
||||
$this->server->addHandler("world.block.update", array($this, "updateBlockRemote"), 1);
|
||||
$this->server->addHandler("player.block.break", array($this, "blockBreak"), 1);
|
||||
$this->server->addHandler("player.block.action", array($this, "blockAction"), 1);
|
||||
}
|
||||
|
||||
public function blockBreak($data, $event){
|
||||
|
@ -29,7 +29,7 @@ class EntityAPI{
|
||||
private $server;
|
||||
function __construct($server){
|
||||
$this->server = $server;
|
||||
$this->server->addHandler("onPlayerDeath", array($this, "handle"), 1);
|
||||
$this->server->addHandler("player.death", array($this, "handle"), 1);
|
||||
}
|
||||
|
||||
public function init(){
|
||||
@ -38,7 +38,7 @@ class EntityAPI{
|
||||
|
||||
public function handle($data, $event){
|
||||
switch($event){
|
||||
case "onPlayerDeath":
|
||||
case "player.death":
|
||||
$message = $data["name"];
|
||||
if(is_numeric($data["cause"]) and isset($this->entities[$data["cause"]])){
|
||||
$e = $this->api->entity->get($data["cause"]);
|
||||
|
@ -57,10 +57,10 @@ class PluginAPI extends stdClass{
|
||||
}
|
||||
$info[$i] = $v;
|
||||
}
|
||||
if(!isset($info["name"]) or !isset($info["version"]) or !isset($info["class"])){
|
||||
if(!isset($info["name"]) or !isset($info["version"]) or !isset($info["class"]) or !isset($info["author"])){
|
||||
console("[ERROR] [PluginAPI] Failed parsing of ".basename($file));
|
||||
}
|
||||
console("[INFO] [PluginAPI] Loading plugin \"".$info["name"]."\" ".$info["version"]);
|
||||
console("[INFO] [PluginAPI] Loading plugin \"".$info["name"]."\" ".$info["version"]." by ".$info["author"]);
|
||||
if(eval($content) === false or !class_exists($info["class"])){
|
||||
console("[ERROR] [PluginAPI] Failed loading plugin");
|
||||
}
|
||||
|
Reference in New Issue
Block a user