Fixed item restoration duplication

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-26 11:57:19 +01:00
parent 5101391c29
commit a0cb4d2698

View File

@ -429,18 +429,17 @@ class Player{
$this->eventHandler("Your connection is bad, you may experience lag and slow map loading.", "server.chat"); $this->eventHandler("Your connection is bad, you may experience lag and slow map loading.", "server.chat");
} }
foreach($this->inventory as $s => $data){ foreach($this->inventory as $s => $data){
if($data[0] <= 0 or $data[2] <= 0){ if($data[0] >= 0 or $data[2] >= 0){
$this->inventory[$s] = array(0, 0, 0); $e = $this->server->api->entity->add(ENTITY_ITEM, $data[0], array(
continue; "x" => $this->entity->x + 0.5,
"y" => $this->entity->y + 0.19,
"z" => $this->entity->z + 0.5,
"meta" => $data[1],
"stack" => $data[2],
));
$this->server->api->entity->spawnTo($e->eid, $this);
} }
$e = $this->server->api->entity->add(ENTITY_ITEM, $data[0], array( $this->inventory[$s] = array(0, 0, 0);
"x" => $this->entity->x + 0.5,
"y" => $this->entity->y + 0.19,
"z" => $this->entity->z + 0.5,
"meta" => $data[1],
"stack" => $data[2],
));
$this->server->api->entity->spawnTo($e->eid, $this);
} }
break; break;
case 2://Chunk loaded? case 2://Chunk loaded?