mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 12:27:51 +00:00
Item change protection
This commit is contained in:
parent
8d7fafe167
commit
c334bbce12
@ -815,7 +815,7 @@ class Player{
|
|||||||
$data["eid"] = $this->eid;
|
$data["eid"] = $this->eid;
|
||||||
$data["player"] = $this;
|
$data["player"] = $this;
|
||||||
$data["item"] = BlockAPI::getItem($data["block"], $data["meta"]);
|
$data["item"] = BlockAPI::getItem($data["block"], $data["meta"]);
|
||||||
if($this->server->handle("player.equipment.change", $data) !== false){
|
if(!$this->hasItem($data["block"], $data["meta"]) and $this->server->getProperty("disallow-crafting") === true and $this->server->handle("player.equipment.change", $data) !== false){
|
||||||
$this->equipment = $data["item"];
|
$this->equipment = $data["item"];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -831,11 +831,8 @@ class Player{
|
|||||||
$data["eid"] = $this->eid;
|
$data["eid"] = $this->eid;
|
||||||
if($this->blocked === true or Utils::distance($this->entity->position, $data) > 10){
|
if($this->blocked === true or Utils::distance($this->entity->position, $data) > 10){
|
||||||
break;
|
break;
|
||||||
}elseif(($this->gamemode === SURVIVAL or $this->gamemode === ADVENTURE) and !$this->hasItem($data["block"], $data["meta"])){
|
}elseif(($this->gamemode === SURVIVAL or $this->gamemode === ADVENTURE) and !$this->hasItem($data["block"], $data["meta"]) and $this->server->getProperty("disallow-crafting") === true){
|
||||||
console("[DEBUG] Player \"".$this->username."\" tried to place not got block (or crafted block)", true, true, 2);
|
break;
|
||||||
if($this->server->getProperty("disallow-crafting") === true){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$this->server->api->block->playerBlockAction($this, new Vector3($data["x"], $data["y"], $data["z"]), $data["face"], $data["fx"], $data["fy"], $data["fz"]);
|
$this->server->api->block->playerBlockAction($this, new Vector3($data["x"], $data["y"], $data["z"]), $data["face"], $data["fx"], $data["fy"], $data["fz"]);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user