mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Data packet handling!!!
This commit is contained in:
@ -28,7 +28,7 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
require_once("classes/Session.class.php");
|
||||
|
||||
class PocketMinecraftServer{
|
||||
protected $interface, $protocol, $entities, $player, $cnt, $events, $username, $version, $clients;
|
||||
protected $interface, $protocol, $entities, $player, $cnt, $events, $username, $version, $clients, $serverType;
|
||||
function __construct($username, $protocol = CURRENT_PROTOCOL, $version = CURRENT_VERSION){
|
||||
//$this->player = new Player($username);
|
||||
$this->version = (int) $version;
|
||||
@ -39,6 +39,7 @@ class PocketMinecraftServer{
|
||||
$this->actions = array();
|
||||
$this->clients = array();
|
||||
$this->protocol = (int) $protocol;
|
||||
$this->setType("normal");
|
||||
$this->interface = new MinecraftInterface("255.255.255.255", $this->protocol, 19132, true, false);
|
||||
console("[INFO] Creating Minecraft Server");
|
||||
console("[INFO] Username: ".$this->username);
|
||||
@ -46,6 +47,18 @@ class PocketMinecraftServer{
|
||||
$this->stop = false;
|
||||
}
|
||||
|
||||
public function setType($type = "demo"){
|
||||
switch($type){
|
||||
case "normal":
|
||||
$this->serverType = "MCCPP;Demo;";
|
||||
break;
|
||||
case "minecon":
|
||||
$this->serverType = "MCCPP;MINECON;";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function action($microseconds, $code){
|
||||
$this->actions[] = array($microseconds / 1000000, microtime(true), $code);
|
||||
console("[INTERNAL] Attached to action ".$microseconds, true, true, 3);
|
||||
@ -86,7 +99,7 @@ class PocketMinecraftServer{
|
||||
$data[0],
|
||||
$this->serverID,
|
||||
MAGIC,
|
||||
"MCCPP;Demo;". $this->username,
|
||||
$this->serverType. $this->username,
|
||||
), false, $packet["ip"], $packet["port"]);
|
||||
break;
|
||||
case 0x05:
|
||||
|
Reference in New Issue
Block a user