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,11 +336,15 @@ class BlockAPI{
|
|||||||
$item = $player->getSlot($player->slot);
|
$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.touch", array("type" => "break", "player" => $player, "target" => $target, "item" => $item)) === false){
|
||||||
return $this->cancelAction($target, $player, 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((!$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)){
|
||||||
return $this->cancelAction($target, $player, false);
|
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);
|
$player->lastBreak = microtime(true);
|
||||||
|
|
||||||
@ -375,12 +379,16 @@ class BlockAPI{
|
|||||||
$item = $player->getSlot($player->slot);
|
$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($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
|
||||||
$this->cancelAction($target, $player);
|
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->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.touch", array("type" => "place", "player" => $player, "block" => $block, "target" => $target, "item" => $item)) === false){
|
||||||
return $this->cancelAction($block, $player);
|
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);
|
$this->blockUpdate($target, BLOCK_UPDATE_TOUCH);
|
||||||
|
|
||||||
@ -391,7 +399,9 @@ class BlockAPI{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(($player->gamemode & 0x02) === 0x02){ //Adventure mode!!
|
if(($player->gamemode & 0x02) === 0x02){ //Adventure mode!!
|
||||||
return $this->cancelAction($block, $player, 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, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($block->y > 127 or $block->y < 0){
|
if($block->y > 127 or $block->y < 0){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user