mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Merge branch 'php/7.0' into mcpe-1.2
This commit is contained in:
@ -133,6 +133,8 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
|
||||
|
||||
public function handleEncapsulated($identifier, EncapsulatedPacket $packet, $flags){
|
||||
if(isset($this->players[$identifier])){
|
||||
//get this now for blocking in case the player was closed before the exception was raised
|
||||
$address = $this->players[$identifier]->getAddress();
|
||||
try{
|
||||
if($packet->buffer !== ""){
|
||||
$pk = $this->getPacket($packet->buffer);
|
||||
@ -143,7 +145,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
|
||||
$logger->debug("Packet " . (isset($pk) ? get_class($pk) : "unknown") . " 0x" . bin2hex($packet->buffer));
|
||||
$logger->logException($e);
|
||||
|
||||
$this->interface->blockAddress($this->players[$identifier]->getAddress(), 5);
|
||||
$this->interface->blockAddress($address, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,11 +34,11 @@ class PlaySoundPacket extends DataPacket{
|
||||
|
||||
/** @var string */
|
||||
public $soundName;
|
||||
/** @var int */
|
||||
/** @var float */
|
||||
public $x;
|
||||
/** @var int */
|
||||
/** @var float */
|
||||
public $y;
|
||||
/** @var int */
|
||||
/** @var float */
|
||||
public $z;
|
||||
/** @var float */
|
||||
public $volume;
|
||||
@ -48,13 +48,16 @@ class PlaySoundPacket extends DataPacket{
|
||||
protected function decodePayload(){
|
||||
$this->soundName = $this->getString();
|
||||
$this->getBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->x /= 8;
|
||||
$this->y /= 8;
|
||||
$this->z /= 8;
|
||||
$this->volume = $this->getLFloat();
|
||||
$this->pitch = $this->getLFloat();
|
||||
}
|
||||
|
||||
protected function encodePayload(){
|
||||
$this->putString($this->soundName);
|
||||
$this->putBlockPosition($this->x, $this->y, $this->z);
|
||||
$this->putBlockPosition((int) ($this->x * 8), (int) ($this->y * 8), (int) ($this->z * 8));
|
||||
$this->putLFloat($this->volume);
|
||||
$this->putLFloat($this->pitch);
|
||||
}
|
||||
|
Reference in New Issue
Block a user