mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-01 23:59:53 +00:00
Cancel correctly Handling Events using return true
This commit is contained in:
parent
bc5516867c
commit
3432a69a41
@ -325,6 +325,7 @@ class BlockAPI{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->updateBlock($data["x"], $data["y"], $data["z"], isset($data["type"]) ? $data["type"]:BLOCK_UPDATE_RANDOM);
|
$this->updateBlock($data["x"], $data["y"], $data["z"], isset($data["type"]) ? $data["type"]:BLOCK_UPDATE_RANDOM);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function flowLavaOn($source, $face){
|
public function flowLavaOn($source, $face){
|
||||||
|
@ -54,6 +54,7 @@ class PlayerAPI{
|
|||||||
$player->setHealth(min(20, $player->getHealth() + $data), "regeneration");
|
$player->setHealth(min(20, $player->getHealth() + $data), "regeneration");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "player.death":
|
case "player.death":
|
||||||
@ -103,6 +104,7 @@ class PlayerAPI{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->server->chat(false, $message);
|
$this->server->chat(false, $message);
|
||||||
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ class PluginAPI extends stdClass{
|
|||||||
if(!isset($info["name"]) or !isset($info["version"]) or !isset($info["class"]) or !isset($info["author"])){
|
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("[ERROR] [PluginAPI] Failed parsing of ".basename($file));
|
||||||
}
|
}
|
||||||
console("[INFO] [PluginAPI] Loading plugin \"\x1b[32m".$info["name"]."\x1b[0m\" \x1b[35m".$info["version"]."\x1b[0m by \x1b[36m".$info["author"]."\x1b[0m");
|
console("[INFO] [PluginAPI] Loading plugin \"\x1b[32m".$info["name"]."\x1b[0m\" \x1b[35m".$info["version"]." #".intval($info["apiversion"])."\x1b[0m by \x1b[36m".$info["author"]."\x1b[0m");
|
||||||
if(class_exists($info["class"])){
|
if(class_exists($info["class"])){
|
||||||
console("[ERROR] [PluginAPI] Failed loading plugin: class exists");
|
console("[ERROR] [PluginAPI] Failed loading plugin: class exists");
|
||||||
}
|
}
|
||||||
@ -84,8 +84,10 @@ class PluginAPI extends stdClass{
|
|||||||
console("[ERROR] [PluginAPI] Failed loading plugin: evaluation error");
|
console("[ERROR] [PluginAPI] Failed loading plugin: evaluation error");
|
||||||
}
|
}
|
||||||
$className = trim($info["class"]);
|
$className = trim($info["class"]);
|
||||||
if(!isset($info["apiversion"]) or intval($info["apiversion"]) < CURRENT_API_VERSION){
|
if(isset($info["apiversion"]) and intval($info["apiversion"]) > CURRENT_API_VERSION){
|
||||||
console("[ERROR] [PluginAPI] Plugin \"".$info["name"]."\" uses an outdated API! It can crash or corrupt the server!");
|
console("[ERROR] [PluginAPI] Plugin \"".$info["name"]."\" uses a newer API! It can crash or corrupt the server!");
|
||||||
|
}elseif(!isset($info["apiversion"]) or intval($info["apiversion"]) < CURRENT_API_VERSION){
|
||||||
|
console("[NOTICE] [PluginAPI] Plugin \"".$info["name"]."\" uses an old API");
|
||||||
}
|
}
|
||||||
if(isset($info["api"]) and $info["api"] !== true){
|
if(isset($info["api"]) and $info["api"] !== true){
|
||||||
console("[INFO] [PluginAPI] Plugin \"\x1b[36m".$info["name"]."\x1b[0m\" got raw access to Server methods");
|
console("[INFO] [PluginAPI] Plugin \"\x1b[36m".$info["name"]."\x1b[0m\" got raw access to Server methods");
|
||||||
|
@ -29,6 +29,7 @@ the Free Software Foundation, either version 3 of the License, or
|
|||||||
class Deprecation{
|
class Deprecation{
|
||||||
public static $events = array(
|
public static $events = array(
|
||||||
"world.block.change" => "block.change",
|
"world.block.change" => "block.change",
|
||||||
|
"block.drop" => "item.drop",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ class PocketMinecraftServer{
|
|||||||
$this->preparedSQL->selectHandlers->clear();
|
$this->preparedSQL->selectHandlers->clear();
|
||||||
$this->preparedSQL->selectHandlers->bindValue(":name", $event, SQLITE3_TEXT);
|
$this->preparedSQL->selectHandlers->bindValue(":name", $event, SQLITE3_TEXT);
|
||||||
$handlers = $this->preparedSQL->selectHandlers->execute();
|
$handlers = $this->preparedSQL->selectHandlers->execute();
|
||||||
$result = true;
|
$result = null;
|
||||||
if($handlers !== false and $handlers !== true){
|
if($handlers !== false and $handlers !== true){
|
||||||
console("[INTERNAL] Handling ".$event, true, true, 3);
|
console("[INTERNAL] Handling ".$event, true, true, 3);
|
||||||
$call = array();
|
$call = array();
|
||||||
@ -225,7 +225,7 @@ class PocketMinecraftServer{
|
|||||||
}
|
}
|
||||||
$handlers->finalize();
|
$handlers->finalize();
|
||||||
foreach($call as $hnid => $boolean){
|
foreach($call as $hnid => $boolean){
|
||||||
if($result !== false){
|
if($result !== false and $result !== true){
|
||||||
$called[$hnid] = true;
|
$called[$hnid] = true;
|
||||||
$handler = $this->handlers[$hnid];
|
$handler = $this->handlers[$hnid];
|
||||||
if(is_array($handler)){
|
if(is_array($handler)){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user