Fixed hack check crash

This commit is contained in:
Shoghi Cervantes Pueyo 2013-04-13 16:22:05 +02:00
parent 439d0ead4f
commit 790b9c19b6

View File

@ -814,7 +814,7 @@ class Player{
$data["eid"] = $this->eid;
$data["player"] = $this;
$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"];
}
break;
@ -830,7 +830,7 @@ 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"]) 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;
}
$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,
);
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(
"eid" => 0,
"event" => 9,
@ -992,7 +992,7 @@ class Player{
$item = BlockAPI::getItem($data["block"], $data["meta"], $data["stack"]);
$data["item"] = $item;
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);
}
}
@ -1072,14 +1072,14 @@ class Player{
}
if($item->getID() !== AIR and $slot->getID() == $item->getID()){
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;
}
}elseif($slot->count > $item->count){
$this->addItem($item->getID(), $item->getMetadata(), $slot->count - $item->count);
}
}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;
}
$this->addItem($slot->getID(), $slot->getMetadata(), $slot->count);