mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
Added item pickup delay
This commit is contained in:
parent
08b67428a0
commit
5096cdcde8
@ -66,7 +66,7 @@ class BlockAPI{
|
|||||||
$amount = (int) $params[2];
|
$amount = (int) $params[2];
|
||||||
}
|
}
|
||||||
if(isset($params[3])){
|
if(isset($params[3])){
|
||||||
$meta = (int) $params[3];
|
$meta = ((int) $params[3]) & 0xFFFF;
|
||||||
}
|
}
|
||||||
if(($player = $this->server->api->player->get($username)) !== false){
|
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);
|
$this->drop($player->entity->x - 0.5, $player->entity->y, $player->entity->z - 0.5, $block, $meta, $amount);
|
||||||
|
@ -131,11 +131,12 @@ class Entity extends stdClass{
|
|||||||
|
|
||||||
public function environmentUpdate(){
|
public function environmentUpdate(){
|
||||||
if($this->class === ENTITY_ITEM){
|
if($this->class === ENTITY_ITEM){
|
||||||
if((microtime(true) - $this->spawntime) >= 300){
|
$time = microtime(true);
|
||||||
|
if(($time - $this->spawntime) >= 300){
|
||||||
$this->close(); //Despawn timer
|
$this->close(); //Despawn timer
|
||||||
return false;
|
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);
|
$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($player !== true and $player !== false){
|
||||||
if($this->server->api->dhandle("player.pickup", array(
|
if($this->server->api->dhandle("player.pickup", array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user