mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 00:55:14 +00:00
Improved some events
This commit is contained in:
@ -76,7 +76,7 @@ class BanAPI{
|
|||||||
switch($event){
|
switch($event){
|
||||||
case "player.flying"://OPs can fly around the server.
|
case "player.flying"://OPs can fly around the server.
|
||||||
if($this->isOp($data->iusername)){
|
if($this->isOp($data->iusername)){
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "player.block.break":
|
case "player.block.break":
|
||||||
@ -92,15 +92,15 @@ class BanAPI{
|
|||||||
break;
|
break;
|
||||||
case "console.command"://Checks if a command is allowed with the current user permissions.
|
case "console.command"://Checks if a command is allowed with the current user permissions.
|
||||||
if(isset($this->cmdWhitelist[$data["cmd"]])){
|
if(isset($this->cmdWhitelist[$data["cmd"]])){
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($data["issuer"] instanceof Player){
|
if($data["issuer"] instanceof Player){
|
||||||
if($this->server->api->handle("console.check", $data) === true or $this->isOp($data["issuer"]->iusername)){
|
if($this->server->api->handle("console.check", $data) === true or $this->isOp($data["issuer"]->iusername)){
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
}elseif($data["issuer"] === "console" or $data["issuer"] === "rcon"){
|
}elseif($data["issuer"] === "console" or $data["issuer"] === "rcon"){
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
@ -236,10 +236,10 @@ class ConsoleAPI{
|
|||||||
$params = array();
|
$params = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->server->api->dhandle("console.command.".$cmd, array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias)) === false
|
if(($d1 = $this->server->api->dhandle("console.command.".$cmd, array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias))) === false
|
||||||
or $this->server->api->dhandle("console.command", array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias)) === false){
|
or ($d2 = $this->server->api->dhandle("console.command", array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias))) === false){
|
||||||
$output = "You don't have permissions to use this command.\n";
|
$output = "You don't have permissions to use this command.\n";
|
||||||
}else{
|
}elseif($d1 !== true and $d2 !== true){
|
||||||
if(isset($this->cmds[$cmd]) and is_callable($this->cmds[$cmd])){
|
if(isset($this->cmds[$cmd]) and is_callable($this->cmds[$cmd])){
|
||||||
$output = @call_user_func($this->cmds[$cmd], $cmd, $params, $issuer, $alias);
|
$output = @call_user_func($this->cmds[$cmd], $cmd, $params, $issuer, $alias);
|
||||||
}elseif($this->server->api->dhandle("console.command.unknown", array("cmd" => $cmd, "params" => $params, "issuer" => $issuer, "alias" => $alias)) !== false){
|
}elseif($this->server->api->dhandle("console.command.unknown", array("cmd" => $cmd, "params" => $params, "issuer" => $issuer, "alias" => $alias)) !== false){
|
||||||
|
@ -1216,6 +1216,22 @@ class Player{
|
|||||||
break;
|
break;
|
||||||
case MC_USE_ITEM:
|
case MC_USE_ITEM:
|
||||||
if($this->spawned === false or $this->blocked === true){
|
if($this->spawned === false or $this->blocked === true){
|
||||||
|
$target = $this->level->getBlock(new Vector3($data["x"], $data["y"], $data["z"]));
|
||||||
|
$block = $target->getSide($data["face"]);
|
||||||
|
$this->dataPacket(MC_UPDATE_BLOCK, array(
|
||||||
|
"x" => $target->x,
|
||||||
|
"y" => $target->y,
|
||||||
|
"z" => $target->z,
|
||||||
|
"block" => $target->getID(),
|
||||||
|
"meta" => $target->getMetadata()
|
||||||
|
));
|
||||||
|
$this->dataPacket(MC_UPDATE_BLOCK, array(
|
||||||
|
"x" => $block->x,
|
||||||
|
"y" => $block->y,
|
||||||
|
"z" => $block->z,
|
||||||
|
"block" => $block->getID(),
|
||||||
|
"meta" => $block->getMetadata()
|
||||||
|
));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->craftingItems = array();
|
$this->craftingItems = array();
|
||||||
@ -1287,6 +1303,14 @@ class Player{
|
|||||||
break;
|
break;
|
||||||
case MC_REMOVE_BLOCK:
|
case MC_REMOVE_BLOCK:
|
||||||
if($this->spawned === false or $this->blocked === true or $this->entity->distance(new Vector3($data["x"], $data["y"], $data["z"])) > 8){
|
if($this->spawned === false or $this->blocked === true or $this->entity->distance(new Vector3($data["x"], $data["y"], $data["z"])) > 8){
|
||||||
|
$target = $this->level->getBlock(new Vector3($data["x"], $data["y"], $data["z"]));
|
||||||
|
$this->dataPacket(MC_UPDATE_BLOCK, array(
|
||||||
|
"x" => $target->x,
|
||||||
|
"y" => $target->y,
|
||||||
|
"z" => $target->z,
|
||||||
|
"block" => $target->getID(),
|
||||||
|
"meta" => $target->getMetadata()
|
||||||
|
));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->craftingItems = array();
|
$this->craftingItems = array();
|
||||||
|
Reference in New Issue
Block a user