From cae6285f64045a8cf8c57eea90e5c803ec4e6404 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Wed, 26 Dec 2012 16:21:50 +0100 Subject: [PATCH] Updated APIs to only allow PocketMinecraftServer object --- classes/API/ConsoleAPI.php | 2 +- classes/API/EntityAPI.php | 4 ++-- classes/API/LevelAPI.php | 2 +- classes/API/PlayerAPI.php | 4 ++-- classes/API/TimeAPI.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/classes/API/ConsoleAPI.php b/classes/API/ConsoleAPI.php index 939214c79..99f600d1e 100644 --- a/classes/API/ConsoleAPI.php +++ b/classes/API/ConsoleAPI.php @@ -27,7 +27,7 @@ the Free Software Foundation, either version 3 of the License, or class ConsoleAPI{ private $input, $server, $event; - function __construct($server){ + function __construct(PocketMinecraftServer $server){ $this->help = array(); $this->server = $server; $this->input = fopen(FILE_PATH."console.in", "w+b"); diff --git a/classes/API/EntityAPI.php b/classes/API/EntityAPI.php index c8a0d57b6..945fdc064 100644 --- a/classes/API/EntityAPI.php +++ b/classes/API/EntityAPI.php @@ -27,12 +27,12 @@ the Free Software Foundation, either version 3 of the License, or class EntityAPI{ private $server; - function __construct($server){ + function __construct(PocketMinecraftServer $server){ $this->server = $server; - $this->server->addHandler("player.death", array($this, "handle"), 1); } public function init(){ + $this->server->addHandler("player.death", array($this, "handle"), 1); $this->server->api->console->register("give", "Give items to a player [DUMMY]", array($this, "commandHandler")); } diff --git a/classes/API/LevelAPI.php b/classes/API/LevelAPI.php index 181480754..b256b606c 100644 --- a/classes/API/LevelAPI.php +++ b/classes/API/LevelAPI.php @@ -27,7 +27,7 @@ the Free Software Foundation, either version 3 of the License, or class LevelAPI{ private $server, $map; - function __construct($server){ + function __construct(PocketMinecraftServer $server){ $this->server = $server; $this->map = $this->server->map; $this->heightMap = array_fill(0, 256, array()); diff --git a/classes/API/PlayerAPI.php b/classes/API/PlayerAPI.php index 8c94bbfb7..db01cc4ad 100644 --- a/classes/API/PlayerAPI.php +++ b/classes/API/PlayerAPI.php @@ -27,12 +27,12 @@ the Free Software Foundation, either version 3 of the License, or class PlayerAPI{ private $server; - function __construct($server){ + function __construct(PocketMinecraftServer $server){ $this->server = $server; - $this->server->event("server.regeneration", array($this, "handle")); } public function init(){ + $this->server->event("server.regeneration", array($this, "handle")); $this->server->api->console->register("list", "Shows connected player list", array($this, "commandHandler")); $this->server->api->console->register("kill", "Kills a player", array($this, "commandHandler")); $this->server->api->console->register("tppos", "Teleports a player to a position", array($this, "commandHandler")); diff --git a/classes/API/TimeAPI.php b/classes/API/TimeAPI.php index b43d3709b..d724b95c4 100644 --- a/classes/API/TimeAPI.php +++ b/classes/API/TimeAPI.php @@ -33,7 +33,7 @@ class TimeAPI{ "sunrise" => 17800, ); private $server; - function __construct($server){ + function __construct(PocketMinecraftServer $server){ $this->server = $server; }