Tile Entities & Signs

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-27 19:36:12 +01:00
parent 3c4888521d
commit 5c11f48270
4 changed files with 210 additions and 12 deletions

View file

@ -386,7 +386,7 @@ class Player{
break;
}
$this->loggedIn = true;
$this->username = str_replace(array("\x00", "/", " ", "\r", "\n"), array("", "-", "_", "", ""), $data["username"]);
$this->username = str_replace(array("\x00", "/", " ", "\r", "\n", '"', "'"), array("", "-", "_", "", "", "", ""), $data["username"]);
if($this->username == ""){
$this->close("bad username", false);
break;
@ -499,6 +499,8 @@ class Player{
}
break;
case MC_REQUEST_CHUNK:
$x = $data["x"] * 16;
$z = $data["z"] * 16;
$this->actionQueue('
$max = max(1, floor(($this->MTU - 16 - 255) / 192));
$chunk = $this->server->api->level->getOrderedChunk('.$data["x"].', '.$data["z"].', $max);
@ -509,6 +511,12 @@ class Player{
"data" => $d,
), true);
}
$tiles = $this->server->query("SELECT * FROM tileentities WHERE x >= '.$x.' AND x < '.($x + 16).' AND z >= '.$z.' AND z < '.($z + 16).';");
if($tiles !== false and $tiles !== true){
while(($tile = $tiles->fetchArray(SQLITE3_ASSOC)) !== false){
$this->server->api->tileentity->spawnTo($tile["ID"], "'.$this->username.'");
}
}
');
console("[INTERNAL] Chunk X ".$data["x"]." Z ".$data["z"]." requested", true, true, 3);
break;