mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 08:39:53 +00:00
Changed class name
This commit is contained in:
parent
fded039485
commit
8208fd2389
@ -337,7 +337,7 @@ class PlayerAPI{
|
||||
$players = array();
|
||||
if($query !== false and $query !== true){
|
||||
while(($d = $query->fetchArray(SQLITE3_ASSOC)) !== false){
|
||||
$CID = PocketMinecraftServer::clientID($d["ip"], $d["port"]);
|
||||
$CID = MainServer::clientID($d["ip"], $d["port"]);
|
||||
if(isset($this->server->clients[$CID])){
|
||||
$players[$CID] = $this->server->clients[$CID];
|
||||
if($multiple === false and $d["name"] === $name){
|
||||
@ -384,7 +384,7 @@ class PlayerAPI{
|
||||
public function getByEID($eid){
|
||||
$eid = (int) $eid;
|
||||
$CID = $this->server->query("SELECT ip,port FROM players WHERE EID = '".$eid."';", true);
|
||||
$CID = PocketMinecraftServer::clientID($CID["ip"], $CID["port"]);
|
||||
$CID = MainServer::clientID($CID["ip"], $CID["port"]);
|
||||
if(isset($this->server->clients[$CID])){
|
||||
return $this->server->clients[$CID];
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class ServerAPI{
|
||||
public $tile;
|
||||
|
||||
/**
|
||||
* @return PocketMinecraftServer
|
||||
* @return MainServer
|
||||
*/
|
||||
public static function request(){
|
||||
return self::$serverRequest;
|
||||
@ -156,7 +156,7 @@ class ServerAPI{
|
||||
UPnP_PortForward($this->getProperty("server-port"));
|
||||
}
|
||||
|
||||
$this->server = new PocketMinecraftServer($this->getProperty("server-name"), $this->getProperty("gamemode"), ($seed = $this->getProperty("level-seed")) != "" ? (int) $seed:false, $this->getProperty("server-port"), ($ip = $this->getProperty("server-ip")) != "" ? $ip:"0.0.0.0");
|
||||
$this->server = new MainServer($this->getProperty("server-name"), $this->getProperty("gamemode"), ($seed = $this->getProperty("level-seed")) != "" ? (int) $seed:false, $this->getProperty("server-port"), ($ip = $this->getProperty("server-ip")) != "" ? $ip:"0.0.0.0");
|
||||
$this->server->api = $this;
|
||||
self::$serverRequest = $this->server;
|
||||
console("[INFO] This server is running PocketMine-MP version ".($version->isDev() ? FORMAT_YELLOW:"").MAJOR_VERSION.FORMAT_RESET." \"".CODENAME."\" (MCPE: ".CURRENT_MINECRAFT_VERSION.") (API ".CURRENT_API_VERSION.")", true, true, 0);
|
||||
@ -293,7 +293,7 @@ class ServerAPI{
|
||||
$this->setProperty("memory-limit", "128M");
|
||||
}
|
||||
|
||||
if($this->server instanceof PocketMinecraftServer){
|
||||
if($this->server instanceof MainServer){
|
||||
$this->server->setType($this->getProperty("server-type"));
|
||||
$this->server->maxClients = $this->getProperty("max-players");
|
||||
$this->server->description = $this->getProperty("description");
|
||||
@ -339,7 +339,7 @@ class ServerAPI{
|
||||
}
|
||||
|
||||
public function init(){
|
||||
if(!(self::$serverRequest instanceof PocketMinecraftServer)){
|
||||
if(!(self::$serverRequest instanceof MainServer)){
|
||||
self::$serverRequest = $this->server;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
class PocketMinecraftServer{
|
||||
class MainServer{
|
||||
public $tCnt;
|
||||
public $serverID, $interface, $database, $version, $invisible, $tickMeasure, $preparedSQL, $spawn, $whitelist, $seed, $stop, $gamemode, $difficulty, $name, $maxClients, $clients, $eidCnt, $custom, $description, $motd, $port, $saveEnabled;
|
||||
private $serverip, $evCnt, $handCnt, $events, $eventsID, $handlers, $serverType, $lastTick, $doTick, $ticks, $memoryStats, $schedule, $asyncThread, $async = array(), $asyncID = 0;
|
||||
@ -482,7 +482,7 @@ class PocketMinecraftServer{
|
||||
|
||||
public function packetHandler(Packet $packet){
|
||||
$data =& $packet;
|
||||
$CID = PocketMinecraftServer::clientID($packet->ip, $packet->port);
|
||||
$CID = MainServer::clientID($packet->ip, $packet->port);
|
||||
if(isset($this->clients[$CID])){
|
||||
$this->clients[$CID]->handlePacket($packet);
|
||||
}else{
|
||||
@ -579,6 +579,7 @@ class PocketMinecraftServer{
|
||||
}
|
||||
}
|
||||
$this->tick();
|
||||
$this->api->server;
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class Player{
|
||||
$this->server = ServerAPI::request();
|
||||
$this->lastBreak = microtime(true);
|
||||
$this->clientID = $clientID;
|
||||
$this->CID = PocketMinecraftServer::clientID($ip, $port);
|
||||
$this->CID = MainServer::clientID($ip, $port);
|
||||
$this->ip = $ip;
|
||||
$this->port = $port;
|
||||
$this->spawnPosition = $this->server->spawn;
|
||||
|
@ -38,13 +38,7 @@ class MinecraftInterface{
|
||||
}
|
||||
|
||||
public function readPacket(){
|
||||
if($this->socket->connected === false){
|
||||
return false;
|
||||
}
|
||||
$buf = "";
|
||||
$source = false;
|
||||
$port = 1;
|
||||
$len = $this->socket->read($buf, $source, $port);
|
||||
$len = $this->socket->read($buf = null, $source = null, $port = null);
|
||||
if($len === false or $len === 0){
|
||||
return false;
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ class UDPSocket{
|
||||
}
|
||||
|
||||
public function close($error = 125){
|
||||
$this->connected = false;
|
||||
return @socket_close($this->sock);
|
||||
}
|
||||
|
||||
@ -58,16 +57,10 @@ class UDPSocket{
|
||||
}
|
||||
|
||||
public function read(&$buf, &$source, &$port){
|
||||
if($this->connected === false){
|
||||
return false;
|
||||
}
|
||||
return @socket_recvfrom($this->sock, $buf, 65535, 0, $source, $port);
|
||||
}
|
||||
|
||||
public function write($data, $dest, $port){
|
||||
if($this->connected === false){
|
||||
return false;
|
||||
}
|
||||
return @socket_sendto($this->sock, $data, strlen($data), 0, $dest, $port);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
if(!class_exists("PocketMinecraftServer", false)){
|
||||
if(!class_exists("MainServer", false)){
|
||||
define("NO_THREADS", true);
|
||||
require_once(dirname(__FILE__)."/../dependencies.php");
|
||||
require_once(FILE_PATH."/src/functions.php");
|
||||
|
Loading…
x
Reference in New Issue
Block a user