mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Improved some events
This commit is contained in:
parent
c83d4d955f
commit
7d3992bcc2
@ -76,7 +76,7 @@ class BanAPI{
|
||||
switch($event){
|
||||
case "player.flying"://OPs can fly around the server.
|
||||
if($this->isOp($data->iusername)){
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "player.block.break":
|
||||
@ -92,15 +92,15 @@ class BanAPI{
|
||||
break;
|
||||
case "console.command"://Checks if a command is allowed with the current user permissions.
|
||||
if(isset($this->cmdWhitelist[$data["cmd"]])){
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if($data["issuer"] instanceof Player){
|
||||
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"){
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
|
@ -236,10 +236,10 @@ class ConsoleAPI{
|
||||
$params = array();
|
||||
}
|
||||
|
||||
if($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){
|
||||
if(($d1 = $this->server->api->dhandle("console.command.".$cmd, 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";
|
||||
}else{
|
||||
}elseif($d1 !== true and $d2 !== true){
|
||||
if(isset($this->cmds[$cmd]) and is_callable($this->cmds[$cmd])){
|
||||
$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){
|
||||
|
@ -1216,6 +1216,22 @@ class Player{
|
||||
break;
|
||||
case MC_USE_ITEM:
|
||||
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;
|
||||
}
|
||||
$this->craftingItems = array();
|
||||
@ -1287,6 +1303,14 @@ class Player{
|
||||
break;
|
||||
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){
|
||||
$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;
|
||||
}
|
||||
$this->craftingItems = array();
|
||||
|
Loading…
x
Reference in New Issue
Block a user