From 6eb37ac72fd9b498d68938097637c644d8a304e1 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Mon, 17 Dec 2012 20:20:07 +0100 Subject: [PATCH] Fixed no events --- TODO | 3 ++- classes/ChunkParser.class.php | 1 - classes/PocketMinecraftServer.class.php | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index b0f84f54a..c0124e893 100644 --- a/TODO +++ b/TODO @@ -2,4 +2,5 @@ - Fix spawn position resetting to 0,128,0 - Mob spawning, item pick up - Fix metadata orientation -- Proper session checks \ No newline at end of file +- Proper session checks +- Fix incorrect timeout \ No newline at end of file diff --git a/classes/ChunkParser.class.php b/classes/ChunkParser.class.php index ffe95ff49..6e4a34c19 100644 --- a/classes/ChunkParser.class.php +++ b/classes/ChunkParser.class.php @@ -159,7 +159,6 @@ class ChunkParser{ $this->map[$x] = array(); for($z = 0; $z < 16; ++$z){ $this->map[$x][$z] = $this->parseChunk($x, $z); - console("[INTERNAL] Chunk X ".$x." Z ".$z." loaded", true, true, 3); } } console("[DEBUG] Chunks loaded!", true, true, 2); diff --git a/classes/PocketMinecraftServer.class.php b/classes/PocketMinecraftServer.class.php index ec3aa3b33..bc0b14355 100644 --- a/classes/PocketMinecraftServer.class.php +++ b/classes/PocketMinecraftServer.class.php @@ -189,11 +189,12 @@ class PocketMinecraftServer extends stdClass{ $priority = (int) $priority; $this->handlers[$this->handCnt] = $callable; $this->query("INSERT INTO handlers (ID, name, priority) VALUES (".$this->handCnt.", '".str_replace("'", "\\'", $event)."', ".$priority.");"); - console("[INTERNAL] New handler ".(is_array($func) ? get_class($func[0])."::".$func[1]:$func)." to special event ".$event." (ID ".$this->handCnt.")", true, true, 3); + console("[INTERNAL] New handler ".(is_array($callable) ? get_class($callable[0])."::".$callable[1]:$callable)." to special event ".$event." (ID ".$this->handCnt.")", true, true, 3); return $this->handCnt++; } public function handle($event, &$data){ + $this->preparedSQL->selectHandlers->clear(); $this->preparedSQL->selectHandlers->bindValue(1, $event, SQLITE3_TEXT); $handlers = $this->preparedSQL->selectHandlers->execute(); if($handlers === false or $handlers === true){ @@ -416,6 +417,7 @@ class PocketMinecraftServer extends stdClass{ } public function trigger($event, $data = ""){ + $this->preparedSQL->selectEvents->clear(); $this->preparedSQL->selectEvents->bindValue(1, $event, SQLITE3_TEXT); $events = $this->preparedSQL->selectEvents->execute(); if($events === false or $events === true){ @@ -445,8 +447,10 @@ class PocketMinecraftServer extends stdClass{ public function tickerFunction($time){ //actions that repeat every x time will go here + $this->preparedSQL->selectActions->clear(); $this->preparedSQL->selectActions->bindValue(1, $time, SQLITE3_FLOAT); $actions = $this->preparedSQL->selectActions->execute(); + if($actions === false or $actions === true){ return; } @@ -456,6 +460,7 @@ class PocketMinecraftServer extends stdClass{ $this->query("DELETE FROM actions WHERE ID = ".$action["ID"].";"); } } + $this->preparedSQL->updateActions->clear(); $this->preparedSQL->updateActions->bindValue(":time", $time, SQLITE3_FLOAT); $this->preparedSQL->updateActions->execute(); }