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(){

View File

@ -61,9 +61,9 @@ class Player{
private $chunksLoaded = array();
private $chunksOrder = array();
function __construct(PocketMinecraftServer $server, $clientID, $ip, $port, $MTU){
function __construct($clientID, $ip, $port, $MTU){
$this->MTU = $MTU;
$this->server = $server;
$this->server = ServerAPI::request();
$this->lastBreak = microtime(true);
$this->clientID = $clientID;
$this->CID = $this->server->clientID($ip, $port);
@ -616,6 +616,7 @@ class Player{
case MC_KEEP_ALIVE:
break;
case 0x01:
case 0x03:
break;

View File

@ -619,7 +619,7 @@ class PocketMinecraftServer{
$port = $data[2];
$MTU = $data[3];
$clientID = $data[4];
$this->clients[$CID] = new Player($this, $clientID, $packet["ip"], $packet["port"], $MTU); //New Session!
$this->clients[$CID] = new Player($clientID, $packet["ip"], $packet["port"], $MTU); //New Session!
$this->clients[$CID]->handle(0x07, $data);
break;
}

View File

@ -31,8 +31,8 @@ define("WINDOW_FURNACE", 2);
class Window{
private $server;
public function __construct(PocketMinecraftServer $server){
public function __construct(){
$this->server = ServerAPI::request();
}
}

View File

@ -28,10 +28,10 @@ the Free Software Foundation, either version 3 of the License, or
class TickLoop extends Thread{
public $tick, $stop, $lastTic;
private $server;
public function __construct(PocketMinecraftServer $server){
public function __construct(){
$this->tick = false;
$this->lastTick = 0;
$this->server = $server;
$this->server = ServerAPI::request();
}
public function run(){
while($this->stop !== true){

View File

@ -74,10 +74,10 @@ class Entity extends stdClass{
private $tickCounter;
private $speedMeasure = array(0, 0, 0, 0, 0);
private $server;
function __construct(PocketMinecraftServer $server, $eid, $class, $type = 0, $data = array()){
function __construct($eid, $class, $type = 0, $data = array()){
$this->fallY = false;
$this->fallStart = false;
$this->server = $server;
$this->server = ServerAPI::request();
$this->eid = (int) $eid;
$this->type = (int) $type;
$this->class = (int) $class;

View File

@ -45,8 +45,8 @@ class TileEntity extends stdClass{
public $metadata;
public $closed;
private $server;
function __construct(PocketMinecraftServer $server, $id, $class, $x, $y, $z, $data = array()){
$this->server = $server;
function __construct($id, $class, $x, $y, $z, $data = array()){
$this->server = ServerAPI::request();
$this->normal = true;
$this->class = $class;
$this->data = $data;