mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +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["player"] = $this;
|
||||
$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"];
|
||||
}
|
||||
break;
|
||||
@ -831,11 +831,8 @@ class Player{
|
||||
$data["eid"] = $this->eid;
|
||||
if($this->blocked === true or Utils::distance($this->entity->position, $data) > 10){
|
||||
break;
|
||||
}elseif(($this->gamemode === SURVIVAL or $this->gamemode === ADVENTURE) and !$this->hasItem($data["block"], $data["meta"])){
|
||||
console("[DEBUG] Player \"".$this->username."\" tried to place not got block (or crafted block)", true, true, 2);
|
||||
if($this->server->getProperty("disallow-crafting") === true){
|
||||
break;
|
||||
}
|
||||
}elseif(($this->gamemode === SURVIVAL or $this->gamemode === ADVENTURE) and !$this->hasItem($data["block"], $data["meta"]) and $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"]);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user