mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Removed protocol Changing
This commit is contained in:
parent
6c8e283599
commit
19436d4953
6 changed files with 11 additions and 56 deletions
|
|
@ -26,14 +26,13 @@ the Free Software Foundation, either version 3 of the License, or
|
|||
*/
|
||||
|
||||
class MinecraftInterface{
|
||||
var $pstruct, $name, $protocol, $client, $dataName;
|
||||
var $pstruct, $name, $client, $dataName;
|
||||
private $socket, $data;
|
||||
function __construct($server, $protocol = CURRENT_PROTOCOL, $port = 25565, $listen = false, $client = true){
|
||||
function __construct($server, $port = 25565, $listen = false, $client = true){
|
||||
$this->socket = new UDPSocket($server, $port, (bool) $listen);
|
||||
$this->protocol = (int) $protocol;
|
||||
require("pstruct/RakNet.php");
|
||||
require("pstruct/packetName.php");
|
||||
require("pstruct/".$this->protocol.".php");
|
||||
require("pstruct/protocol.php");
|
||||
require("pstruct/dataName.php");
|
||||
$this->pstruct = $pstruct;
|
||||
$this->name = $packetName;
|
||||
|
|
@ -93,7 +92,6 @@ class MinecraftInterface{
|
|||
}
|
||||
|
||||
$packet = new Packet($pid, $struct, $data[0]);
|
||||
$packet->protocol = $this->protocol;
|
||||
$packet->parse();
|
||||
$this->data[] = array($pid, $packet->data, $data[0], $data[1], $data[2]);
|
||||
return $this->popPacket();
|
||||
|
|
@ -119,7 +117,6 @@ class MinecraftInterface{
|
|||
$struct = $this->getStruct($pid);
|
||||
if($raw === false){
|
||||
$packet = new Packet($pid, $struct);
|
||||
$packet->protocol = $this->protocol;
|
||||
$packet->data = $data;
|
||||
$packet->create();
|
||||
$write = $this->socket->write($packet->raw, $dest, $port);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ the Free Software Foundation, either version 3 of the License, or
|
|||
class Packet{
|
||||
private $struct, $sock;
|
||||
protected $pid, $packet;
|
||||
public $data, $raw, $protocol;
|
||||
public $data, $raw;
|
||||
|
||||
function __construct($pid, $struct, $data = ""){
|
||||
$this->pid = $pid;
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ the Free Software Foundation, either version 3 of the License, or
|
|||
*/
|
||||
|
||||
class PocketMinecraftServer extends stdClass{
|
||||
var $invisible, $tickMeasure, $preparedSQL, $seed, $protocol, $gamemode, $name, $maxClients, $clients, $eidCnt, $custom, $description, $motd, $timePerSecond, $responses, $spawn, $entities, $mapDir, $mapName, $map, $level, $tileEntities;
|
||||
var $invisible, $tickMeasure, $preparedSQL, $seed, $gamemode, $name, $maxClients, $clients, $eidCnt, $custom, $description, $motd, $timePerSecond, $responses, $spawn, $entities, $mapDir, $mapName, $map, $level, $tileEntities;
|
||||
private $database, $interface, $evCnt, $handCnt, $events, $handlers, $version, $serverType, $lastTick;
|
||||
function __construct($name, $gamemode = 1, $seed = false, $protocol = CURRENT_PROTOCOL, $port = 19132, $serverID = false, $version = CURRENT_VERSION){
|
||||
function __construct($name, $gamemode = 1, $seed = false, $port = 19132, $serverID = false, $version = CURRENT_VERSION){
|
||||
$this->port = (int) $port; //19132 - 19135
|
||||
console("[INFO] PocketMine-MP ".MAJOR_VERSION." by @shoghicp, LGPL License", true, true, 0);
|
||||
console("[INFO] Starting Minecraft PE Server at *:".$this->port);
|
||||
|
|
@ -64,17 +64,16 @@ class PocketMinecraftServer extends stdClass{
|
|||
$this->serverID = $serverID === false ? Utils::readLong(Utils::getRandomBytes(8)):$serverID;
|
||||
$this->seed = $seed === false ? Utils::readInt(Utils::getRandomBytes(4)):$seed;
|
||||
$this->clients = array();
|
||||
$this->protocol = (int) $protocol;
|
||||
$this->spawn = array("x" => 128.5,"y" => 100,"z" => 128.5);
|
||||
$this->time = 0;
|
||||
$this->timePerSecond = 10;
|
||||
$this->tickMeasure = array_fill(0, 40, 0);
|
||||
$this->setType("normal");
|
||||
$this->interface = new MinecraftInterface("255.255.255.255", $this->protocol, $this->port, true, false);
|
||||
$this->interface = new MinecraftInterface("255.255.255.255", $this->port, true, false);
|
||||
$this->reloadConfig();
|
||||
console("[INFO] Server Name: ".$this->name);
|
||||
console("[INFO] Server GUID: ".$this->serverID);
|
||||
console("[INFO] Protocol Version: ".$this->protocol);
|
||||
console("[INFO] Protocol Version: ".CURRENT_PROTOCOL);
|
||||
console("[INFO] Max Clients: ".$this->maxClients);
|
||||
$this->stop = false;
|
||||
}
|
||||
|
|
@ -397,9 +396,9 @@ class PocketMinecraftServer extends stdClass{
|
|||
}
|
||||
$version = $data[1];
|
||||
$size = strlen($data[2]);
|
||||
if($version !== $this->protocol){
|
||||
if($version !== CURRENT_PROTOCOL){
|
||||
$this->send(0x1a, array(
|
||||
$this->protocol,
|
||||
CURRENT_PROTOCOL,
|
||||
MAGIC,
|
||||
$this->serverID,
|
||||
), false, $packet["ip"], $packet["port"]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue