mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 07:39:42 +00:00
Removed server.tick event
This commit is contained in:
@@ -36,7 +36,7 @@ class ConsoleAPI{
|
||||
}
|
||||
|
||||
public function init(){
|
||||
$this->event = $this->server->event("server.tick", array($this, "handle"));
|
||||
$this->server->schedule(2, array($this, "handle"), array(), true);
|
||||
$this->loop = new ConsoleLoop();
|
||||
$this->register("help", "[page|command name]", array($this, "defaultCommands"));
|
||||
$this->register("status", "", array($this, "defaultCommands"));
|
||||
|
||||
@@ -48,14 +48,20 @@ class EntityAPI{
|
||||
|
||||
public function updateEntities(){
|
||||
$l = $this->server->query("SELECT EID FROM entities WHERE hasUpdate = 1;");
|
||||
$this->server->query("UPDATE entities SET hasUpdate = 0;");
|
||||
|
||||
if($l !== false and $l !== true){
|
||||
$q = "";
|
||||
while(($e = $l->fetchArray(SQLITE3_ASSOC)) !== false){
|
||||
$e = $this->get($e["EID"]);
|
||||
if($e instanceof Entity){
|
||||
console($e->eid);
|
||||
$e->update();
|
||||
$q .= "UPDATE entities SET hasUpdate = 0 WHERE EID = ".$e->eid.";";
|
||||
}
|
||||
}
|
||||
if($q !== ""){
|
||||
$this->server->query("BEGIN TRANSACTION;".$q.";COMMIT;");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user