From 539c8046d80f38fb0623121f24c0aeddf2d26056 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Sun, 7 Apr 2013 13:47:11 +0200 Subject: [PATCH] Removed deprecated chat() method in server --- src/PocketMinecraftServer.php | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index dcd7cff5..a7b102b9 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -28,7 +28,7 @@ the Free Software Foundation, either version 3 of the License, or class PocketMinecraftServer{ public $tCnt; public $version, $invisible, $api, $tickMeasure, $preparedSQL, $seed, $gamemode, $name, $maxClients, $clients, $eidCnt, $custom, $description, $motd, $timePerSecond, $spawn, $entities, $mapDir, $mapName, $map, $levelData, $tileEntities; - private $serverip, $database, $interface, $evCnt, $handCnt, $events, $eventsID, $handlers, $serverType, $lastTick, $ticker; + private $serverip, $database, $interface, $evCnt, $handCnt, $events, $eventsID, $handlers, $serverType, $lastTick; private function load(){ $this->version = new VersionString(); @@ -46,7 +46,6 @@ class PocketMinecraftServer{ $this->seed = $this->seed === false ? Utils::readInt(Utils::getRandomBytes(4, false)):$this->seed; console("[INFO] Loading database..."); $this->startDatabase(); - $this->doTick = false; $this->api = false; $this->tCnt = 1; $this->mapDir = false; @@ -84,6 +83,7 @@ class PocketMinecraftServer{ function __construct($name, $gamemode = CREATIVE, $seed = false, $port = 19132, $serverID = false, $serverip = "0.0.0.0"){ $this->port = (int) $port; //19132 - 19135 + $this->doTick = true; $this->gamemode = (int) $gamemode; $this->name = $name; $this->motd = "Welcome to ".$name; @@ -175,10 +175,9 @@ class PocketMinecraftServer{ } if(($this->api instanceof ServerAPI) === true){ if(($this->api->chat instanceof ChatAPI) === true){ - $this->api->chat->send(false, "Stopping server..."); + $this->api->chat->broadcast("Stopping server..."); } } - //$this->ticker->stop = true; $this->save(true); $this->stop = true; $this->trigger("server.close", $reason); @@ -186,10 +185,6 @@ class PocketMinecraftServer{ } } - public function chat($owner, $text, $target = false){ - $this->api->chat->send($owner, $text, $target); - } - public function setType($type = "normal"){ switch($type){ case "normal": @@ -446,8 +441,6 @@ class PocketMinecraftServer{ } console("[INFO] Loading events..."); $this->loadEvents(); - //$this->ticker = new TickLoop($this); - //$this->ticker->start(); declare(ticks=40); register_tick_function(array($this, "tick")); register_shutdown_function(array($this, "dumpError")); @@ -496,15 +489,6 @@ class PocketMinecraftServer{ } public function tick(){ - /*if($this->ticker->tick === true and $this->ticker->isWaiting() === true){ - $this->ticker->tick = false; - $time = microtime(true); - array_shift($this->tickMeasure); - $this->tickMeasure[] = $this->lastTick = $time; - $this->tickerFunction($time); - $this->trigger("server.tick", $time); - $this->ticker->notify(); - }*/ $time = microtime(true); if($this->lastTick <= ($time - 0.05)){ array_shift($this->tickMeasure);