mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Added RakLib library
This commit is contained in:
parent
97f3959e83
commit
905d572d42
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -1,4 +1,8 @@
|
||||
[submodule "src/pocketmine/gui"]
|
||||
path = src/pocketmine/gui
|
||||
url = https://github.com/PocketMine/PocketMine-MP-GUI.git
|
||||
url = git://github.com/PocketMine/PocketMine-MP-GUI.git
|
||||
branch = master
|
||||
[submodule "src/raklib"]
|
||||
path = src/raklib
|
||||
url = git://github.com/PocketMine/RakLib.git
|
||||
branch = master
|
||||
|
@ -315,12 +315,31 @@ namespace pocketmine {
|
||||
$logger->warning("Non-packaged PocketMine-MP installation detected, do not use on production.");
|
||||
}
|
||||
|
||||
$server = new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
|
||||
include_once("../RakLib/raklib/RakLib.php");
|
||||
\raklib\RakLib::bootstrap($autoloader);
|
||||
$server = new \raklib\server\RakLibServer($logger, $autoloader, 19132, "192.168.1.1");
|
||||
$socket = $server->getExternalSocket();
|
||||
while(true){
|
||||
if(($len = @socket_read($socket, 4)) !== ""){
|
||||
$packet = socket_read($socket, Binary::readInt($len));
|
||||
$id = ord($packet{0});
|
||||
if($id === \raklib\RakLib::PACKET_ENCAPSULATED){
|
||||
$len = ord($packet{1});
|
||||
$identifier = substr($packet, 2, $len);
|
||||
$buffer = substr($packet, 2 + $len);
|
||||
$pk = \raklib\protocol\EncapsulatedPacket::fromBinary($buffer);
|
||||
var_dump($pk);
|
||||
|
||||
}
|
||||
}
|
||||
usleep(1000);
|
||||
}
|
||||
/*$server = new Server($autoloader, $logger, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
|
||||
$server->start();
|
||||
$logger->shutdown();
|
||||
$logger->join();
|
||||
|
||||
kill(getmypid());
|
||||
exit(0);
|
||||
exit(0);*/
|
||||
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 729b3d8c97e2e66431c28063027060c11bdd3c15
|
||||
Subproject commit 1b900a16eaf5bbd800828e3105432a3e96403f87
|
53
src/pocketmine/network/SourceInterface.php
Normal file
53
src/pocketmine/network/SourceInterface.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Network-related classes
|
||||
*/
|
||||
namespace pocketmine\network;
|
||||
|
||||
use pocketmine\network\protocol\DataPacket;
|
||||
|
||||
/**
|
||||
* Classes that implement this interface will be able to be attached to players
|
||||
*/
|
||||
interface SourceInterface{
|
||||
|
||||
/**
|
||||
* Sends a DataPacket to the interface
|
||||
*
|
||||
* @param DataPacket $packet
|
||||
*/
|
||||
public function putPacket(DataPacket $packet);
|
||||
|
||||
/**
|
||||
* Gets the next data packet to handle, null if none
|
||||
*
|
||||
* @return DataPacket
|
||||
*/
|
||||
public function getPacket();
|
||||
|
||||
/**
|
||||
* Terminates the connection
|
||||
*/
|
||||
public function close();
|
||||
|
||||
}
|
@ -28,16 +28,6 @@ abstract class DataPacket extends \stdClass{
|
||||
private $offset = 0;
|
||||
public $buffer = "";
|
||||
|
||||
public $reliability = 0;
|
||||
public $hasSplit = false;
|
||||
public $messageIndex;
|
||||
public $orderIndex;
|
||||
public $orderChannel;
|
||||
public $splitCount;
|
||||
public $splitID;
|
||||
public $splitIndex;
|
||||
|
||||
|
||||
abstract public function pid();
|
||||
|
||||
abstract public function encode();
|
||||
|
1
src/raklib
Submodule
1
src/raklib
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit bf180fdfa72ed4893c16054768d9564487c36d26
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if(!class_exists("SplAutoloader")){
|
||||
if(!interface_exists("SplAutoloader", false)){
|
||||
require("SplAutoloader.php");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user