mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-01 23:59:53 +00:00
Fixed hack check crash
This commit is contained in:
parent
439d0ead4f
commit
790b9c19b6
@ -814,7 +814,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->hasItem($data["block"], $data["meta"]) or $this->server->getProperty("disallow-crafting") !== true) and $this->server->handle("player.equipment.change", $data) !== false){
|
if(($this->hasItem($data["block"], $data["meta"]) or $this->server->api->getProperty("disallow-crafting") !== true) and $this->server->handle("player.equipment.change", $data) !== false){
|
||||||
$this->equipment = $data["item"];
|
$this->equipment = $data["item"];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -830,7 +830,7 @@ 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"]) and $this->server->getProperty("disallow-crafting") === true){
|
}elseif(($this->gamemode === SURVIVAL or $this->gamemode === ADVENTURE) and !$this->hasItem($data["block"], $data["meta"]) and $this->server->api->getProperty("disallow-crafting") === true){
|
||||||
break;
|
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"]);
|
||||||
@ -974,7 +974,7 @@ class Player{
|
|||||||
364 => 8,
|
364 => 8,
|
||||||
);
|
);
|
||||||
if(isset($items[$this->equipment->getID()])){
|
if(isset($items[$this->equipment->getID()])){
|
||||||
if($this->removeItem($this->equipment->getID(), $this->equipment->getMetadata(), 1) === true or $this->server->getProperty("disallow-crafting") !== true){
|
if($this->removeItem($this->equipment->getID(), $this->equipment->getMetadata(), 1) === true or $this->server->api->getProperty("disallow-crafting") !== true){
|
||||||
$this->dataPacket(MC_ENTITY_EVENT, array(
|
$this->dataPacket(MC_ENTITY_EVENT, array(
|
||||||
"eid" => 0,
|
"eid" => 0,
|
||||||
"event" => 9,
|
"event" => 9,
|
||||||
@ -992,7 +992,7 @@ class Player{
|
|||||||
$item = BlockAPI::getItem($data["block"], $data["meta"], $data["stack"]);
|
$item = BlockAPI::getItem($data["block"], $data["meta"], $data["stack"]);
|
||||||
$data["item"] = $item;
|
$data["item"] = $item;
|
||||||
if($this->blocked === false and $this->server->handle("player.drop", $data) !== false){
|
if($this->blocked === false and $this->server->handle("player.drop", $data) !== false){
|
||||||
if($this->removeItem($item->getID(), $item->getMetadata(), $item->count) === true or $this->server->getProperty("disallow-crafting") !== true){
|
if($this->removeItem($item->getID(), $item->getMetadata(), $item->count) === true or $this->server->api->getProperty("disallow-crafting") !== true){
|
||||||
$this->server->api->block->drop(new Vector3($this->entity->x - 0.5, $this->entity->y, $this->entity->z - 0.5), $item);
|
$this->server->api->block->drop(new Vector3($this->entity->x - 0.5, $this->entity->y, $this->entity->z - 0.5), $item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1072,14 +1072,14 @@ class Player{
|
|||||||
}
|
}
|
||||||
if($item->getID() !== AIR and $slot->getID() == $item->getID()){
|
if($item->getID() !== AIR and $slot->getID() == $item->getID()){
|
||||||
if($slot->count < $item->count){
|
if($slot->count < $item->count){
|
||||||
if($this->removeItem($item->getID(), $item->getMetadata(), $item->count - $slot->count) === false and $this->server->getProperty("disallow-crafting") === true){
|
if($this->removeItem($item->getID(), $item->getMetadata(), $item->count - $slot->count) === false and $this->server->api->getProperty("disallow-crafting") === true){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}elseif($slot->count > $item->count){
|
}elseif($slot->count > $item->count){
|
||||||
$this->addItem($item->getID(), $item->getMetadata(), $slot->count - $item->count);
|
$this->addItem($item->getID(), $item->getMetadata(), $slot->count - $item->count);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if($this->removeItem($item->getID(), $item->getMetadata(), $item->count) === false and $this->server->getProperty("disallow-crafting") === true){
|
if($this->removeItem($item->getID(), $item->getMetadata(), $item->count) === false and $this->server->api->getProperty("disallow-crafting") === true){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->addItem($slot->getID(), $slot->getMetadata(), $slot->count);
|
$this->addItem($slot->getID(), $slot->getMetadata(), $slot->count);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user