Updated TileEntity API [fixes #306]

This commit is contained in:
Shoghi Cervantes
2013-05-29 23:13:01 +02:00
parent 25de7a68d5
commit 450b5d9560
5 changed files with 10 additions and 53 deletions

View File

@@ -35,21 +35,11 @@ class TileEntityAPI{
}
public function get(Position $pos){
$tiles = $this->server->query("SELECT * FROM tileentities WHERE level = '".$pos->level->getName()."' AND x = {$pos->x} AND y = {$pos->y} AND z = {$pos->z};");
$ret = array();
if($tiles !== false and $tiles !== true){
while(($t = $tiles->fetchArray(SQLITE3_ASSOC)) !== false){
if(($tile = $this->getByID($t["ID"])) !== false){
if($tile->normal === true){
$ret[] = $tile;
}
}
}
$tile = $this->server->query("SELECT * FROM tileentities WHERE level = '".$pos->level->getName()."' AND x = {$pos->x} AND y = {$pos->y} AND z = {$pos->z};", true);
if($tile !== false and $tile !== true and ($tile = $this->getByID($tile["ID"])) !== false){
return $tile;
}
if(count($ret) === 0){
return false;
}
return $ret;
return false;
}
public function getByID($id){