mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 00:59:51 +00:00
Added player.block.place.bypass and player.block.break.bypass
This commit is contained in:
parent
6cf8698826
commit
cc57475f91
@ -336,12 +336,16 @@ class BlockAPI{
|
||||
$item = $player->getSlot($player->slot);
|
||||
|
||||
if($this->server->api->dhandle("player.block.touch", array("type" => "break", "player" => $player, "target" => $target, "item" => $item)) === false){
|
||||
if($this->server->api->dhandle("player.block.break.bypass", array("player" => $player, "target" => $target, "item" => $item)) !== true){
|
||||
return $this->cancelAction($target, $player, false);
|
||||
}
|
||||
}
|
||||
|
||||
if((!$target->isBreakable($item, $player) and $this->server->api->dhandle("player.block.break.invalid", array("player" => $player, "target" => $target, "item" => $item)) !== true) or ($player->gamemode & 0x02) === 0x02 or (($player->lastBreak - $player->getLag() / 1000) + $target->getBreakTime($item, $player) - 0.1) >= microtime(true)){
|
||||
if($this->server->api->dhandle("player.block.break.bypass", array("player" => $player, "target" => $target, "item" => $item)) !== true){
|
||||
return $this->cancelAction($target, $player, false);
|
||||
}
|
||||
}
|
||||
$player->lastBreak = microtime(true);
|
||||
|
||||
if($this->server->api->dhandle("player.block.break", array("player" => $player, "target" => $target, "item" => $item)) !== false){
|
||||
@ -375,13 +379,17 @@ class BlockAPI{
|
||||
$item = $player->getSlot($player->slot);
|
||||
|
||||
if($target->getID() === AIR and $this->server->api->dhandle("player.block.place.invalid", array("player" => $player, "block" => $block, "target" => $target, "item" => $item)) !== true){ //If no block exists or not allowed in CREATIVE
|
||||
if($this->server->api->dhandle("player.block.place.bypass", array("player" => $player, "block" => $block, "target" => $target, "item" => $item)) !== true){
|
||||
$this->cancelAction($target, $player);
|
||||
return $this->cancelAction($block, $player);
|
||||
}
|
||||
}
|
||||
|
||||
if($this->server->api->dhandle("player.block.touch", array("type" => "place", "player" => $player, "block" => $block, "target" => $target, "item" => $item)) === false){
|
||||
if($this->server->api->dhandle("player.block.place.bypass", array("player" => $player, "block" => $block, "target" => $target, "item" => $item)) !== true){
|
||||
return $this->cancelAction($block, $player);
|
||||
}
|
||||
}
|
||||
$this->blockUpdate($target, BLOCK_UPDATE_TOUCH);
|
||||
|
||||
if($target->isActivable === true){
|
||||
@ -391,8 +399,10 @@ class BlockAPI{
|
||||
}
|
||||
|
||||
if(($player->gamemode & 0x02) === 0x02){ //Adventure mode!!
|
||||
if($this->server->api->dhandle("player.block.place.bypass", array("player" => $player, "block" => $block, "target" => $target, "item" => $item)) !== true){
|
||||
return $this->cancelAction($block, $player, false);
|
||||
}
|
||||
}
|
||||
|
||||
if($block->y > 127 or $block->y < 0){
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user