mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 22:15:30 +00:00
Fixes
This commit is contained in:
parent
c104e21ef0
commit
3fce458406
@ -29,7 +29,7 @@ class MinecraftInterface{
|
||||
var $pstruct, $name, $server, $protocol, $client, $buffer, $dataName;
|
||||
|
||||
function __construct($server, $protocol = CURRENT_PROTOCOL, $port = 25565, $listen = false, $client = true){
|
||||
$this->server = new Socket($server, $port, (bool) $listen);
|
||||
$this->server = new UDPSocket($server, $port, (bool) $listen);
|
||||
$this->protocol = (int) $protocol;
|
||||
require("pstruct/RakNet.php");
|
||||
require("pstruct/packetName.php");
|
||||
@ -59,7 +59,7 @@ class MinecraftInterface{
|
||||
$p .= Utils::hexdump($raw);
|
||||
if(is_array($data)){
|
||||
foreach($data as $i => $d){
|
||||
$p .= $i ." => ".(!is_array($d) ? $this->pstruct[$pid][$i]."(".(($this->pstruct[$pid][$i] === "magic" or substr($this->pstruct[$pid][$i], 0, 7) === "special" or is_int($this->pstruct[$pid][$i])) ? Utils::strToHex($d):$d).")":$this->pstruct[$pid][$i]."(\"".serialize($d)."\")").PHP_EOL;
|
||||
$p .= $i ." => ".(!is_array($d) ? $this->pstruct[$pid][$i]."(".(($this->pstruct[$pid][$i] === "magic" or substr($this->pstruct[$pid][$i], 0, 7) === "special" or is_int($this->pstruct[$pid][$i])) ? Utils::strToHex($d):Utils::printable($d)).")":$this->pstruct[$pid][$i]."(\"".serialize(array_map("Utils::printable", $d))."\")").PHP_EOL;
|
||||
}
|
||||
}
|
||||
$p .= PHP_EOL;
|
||||
|
@ -72,17 +72,17 @@ class SerializedPacketHandler{
|
||||
$pk = new CustomPacketHandler($id, $raw);
|
||||
$pk->data["length"] = $len;
|
||||
$pk->data["id"] = $id;
|
||||
if($pid !== 0x00 and $i === 0){
|
||||
if($pid !== 0x00){
|
||||
$pk->data["counter"] = $c;
|
||||
}
|
||||
$pk->data["packetName"] = $pk->name;
|
||||
$this->data["packets"][] = array($pid, $pk->data, $raw);
|
||||
if($pid === 0x60 and $i === 0){
|
||||
/*if($pid === 0x60 and $i === 0){
|
||||
$l = $this->get(3);
|
||||
if(strlen($l) === 3){
|
||||
$this->data["unknown2"] = $this->get(Utils::readTriad($l));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
|
||||
|
||||
|
||||
class Socket{
|
||||
class UDPSocket{
|
||||
private $encrypt;
|
||||
var $buffer, $connected, $errors, $sock, $server;
|
||||
|
@ -143,6 +143,10 @@ class Utils{
|
||||
return $output;
|
||||
}
|
||||
|
||||
public static function printable($str){
|
||||
return preg_replace('#([^\x20-\x7E])#', '.', $str);
|
||||
}
|
||||
|
||||
public static function microtime(){
|
||||
return microtime(true);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ if($errors > 0){
|
||||
}
|
||||
|
||||
require_once("classes/Utils.class.php");
|
||||
require_once("classes/Socket.class.php");
|
||||
require_once("classes/UDPSocket.class.php");
|
||||
require_once("classes/Packet.class.php");
|
||||
require_once("classes/SerializedPacketHandler.class.php");
|
||||
require_once("classes/CustomPacketHandler.class.php");
|
||||
|
Loading…
x
Reference in New Issue
Block a user