Removed $server constructor arguments because of ServerAPI::request()

This commit is contained in:
Shoghi Cervantes Pueyo
2013-03-29 19:49:33 +01:00
parent af52b0a5b5
commit 6d39f54591
17 changed files with 35 additions and 34 deletions

View File

@@ -32,8 +32,8 @@ class BanAPI{
private $ops;
private $bannedIPs;
private $cmdWL = array();
function __construct(PocketMinecraftServer $server){
$this->server = $server;
function __construct(){
$this->server = ServerAPI::request();
}
public function init(){

View File

@@ -112,8 +112,8 @@ class BlockAPI{
return $this->getBlock($block->getSide($face));
}
function __construct(PocketMinecraftServer $server){
$this->server = $server;
function __construct(){
$this->server = ServerAPI::request();
}
public function init(){

View File

@@ -27,8 +27,8 @@ the Free Software Foundation, either version 3 of the License, or
class ChatAPI{
private $server;
function __construct(PocketMinecraftServer $server){
$this->server = $server;
function __construct(){
$this->server = ServerAPI::request();
}
public function init(){

View File

@@ -27,11 +27,11 @@ the Free Software Foundation, either version 3 of the License, or
class ConsoleAPI{
private $loop, $server, $event, $help, $cmds, $alias;
function __construct(PocketMinecraftServer $server){
function __construct(){
$this->help = array();
$this->cmds = array();
$this->alias = array();
$this->server = $server;
$this->server = ServerAPI::request();
$this->last = microtime(true);
}

View File

@@ -27,8 +27,8 @@ the Free Software Foundation, either version 3 of the License, or
class EntityAPI{
private $server;
function __construct(PocketMinecraftServer $server){
$this->server = $server;
function __construct(){
$this->server = ServerAPI::request();
}
public function get($eid){
@@ -60,7 +60,7 @@ class EntityAPI{
public function add($class, $type = 0, $data = array()){
$eid = $this->server->eidCnt++;
$this->server->entities[$eid] = new Entity($this->server, $eid, $class, $type, $data);
$this->server->entities[$eid] = new Entity($eid, $class, $type, $data);
$this->server->handle("entity.add", $this->server->entities[$eid]);
return $this->server->entities[$eid];
}

View File

@@ -27,8 +27,8 @@ the Free Software Foundation, either version 3 of the License, or
class LevelAPI{
private $server, $map;
function __construct(PocketMinecraftServer $server){
$this->server = $server;
function __construct(){
$this->server = ServerAPI::request();
$this->map = $this->server->map;
$this->heightMap = array_fill(0, 256, array());
}

View File

@@ -27,8 +27,8 @@ the Free Software Foundation, either version 3 of the License, or
class PlayerAPI{
private $server;
function __construct(PocketMinecraftServer $server){
$this->server = $server;
function __construct(){
$this->server = ServerAPI::request();
}
public function init(){

View File

@@ -28,8 +28,8 @@ the Free Software Foundation, either version 3 of the License, or
class PluginAPI extends stdClass{
private $server;
private $plugins = array();
public function __construct(PocketMinecraftServer $server){
$this->server = $server;
public function __construct(){
$this->server = ServerAPI::request();
}
public function getList(){

View File

@@ -474,7 +474,7 @@ class ServerAPI{
}else{
$internal = true;
}
$this->$name = new $class($this->server);
$this->$name = new $class();
$this->apiList[] = $this->$name;
console("[".($internal === true ? "DEBUG":"INFO")."] API \x1b[36m".$name."\x1b[0m [\x1b[30;1m".$class."\x1b[0m] loaded", true, true, ($internal === true ? 2:1));
}

View File

@@ -27,8 +27,8 @@ the Free Software Foundation, either version 3 of the License, or
class TileEntityAPI{
private $server;
function __construct(PocketMinecraftServer $server){
$this->server = $server;
function __construct(){
$this->server = ServerAPI::request();
}
public function get($x, $y = false, $z = false){
@@ -77,7 +77,7 @@ class TileEntityAPI{
public function add($class, $x, $y, $z, $data = array()){
$id = $this->tCnt++;
$this->server->tileEntities[$id] = new TileEntity($this->server, $id, $class, $x, $y, $z, $data);
$this->server->tileEntities[$id] = new TileEntity($id, $class, $x, $y, $z, $data);
$this->spawnToAll($id);
return $this->server->tileEntities[$id];
}

View File

@@ -33,8 +33,8 @@ class TimeAPI{
"sunrise" => 17800,
);
private $server;
function __construct(PocketMinecraftServer $server){
$this->server = $server;
function __construct(){
$this->server = ServerAPI::request();
}
public function init(){