Added item pickup delay

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-30 18:02:13 +01:00
parent 08b67428a0
commit 5096cdcde8
2 changed files with 4 additions and 3 deletions

View File

@ -66,7 +66,7 @@ class BlockAPI{
$amount = (int) $params[2];
}
if(isset($params[3])){
$meta = (int) $params[3];
$meta = ((int) $params[3]) & 0xFFFF;
}
if(($player = $this->server->api->player->get($username)) !== false){
$this->drop($player->entity->x - 0.5, $player->entity->y, $player->entity->z - 0.5, $block, $meta, $amount);

View File

@ -131,11 +131,12 @@ class Entity extends stdClass{
public function environmentUpdate(){
if($this->class === ENTITY_ITEM){
if((microtime(true) - $this->spawntime) >= 300){
$time = microtime(true);
if(($time - $this->spawntime) >= 300){
$this->close(); //Despawn timer
return false;
}
if($this->server->gamemode === 0){
if($this->server->gamemode === 0 and ($time - $this->spawntime) >= 2){
$player = $this->server->query("SELECT EID FROM entities WHERE class == ".ENTITY_PLAYER." AND abs(x - {$this->x}) <= 1.5 AND abs(y - {$this->y}) <= 1.5 AND abs(z - {$this->z}) <= 1.5 LIMIT 1;", true);
if($player !== true and $player !== false){
if($this->server->api->dhandle("player.pickup", array(