mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 08:49:42 +00:00
Merge branch '3.5'
This commit is contained in:
commit
60687d8d6c
@ -109,7 +109,7 @@ class BookEditPacket extends DataPacket{
|
|||||||
$this->putString($this->xuid);
|
$this->putString($this->xuid);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new \UnexpectedValueException("Unknown book edit type $this->type!");
|
throw new \InvalidArgumentException("Unknown book edit type $this->type!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class ClientboundMapItemDataPacket extends DataPacket{
|
|||||||
}elseif($object->type === MapTrackedObject::TYPE_ENTITY){
|
}elseif($object->type === MapTrackedObject::TYPE_ENTITY){
|
||||||
$object->entityUniqueId = $this->getEntityUniqueId();
|
$object->entityUniqueId = $this->getEntityUniqueId();
|
||||||
}else{
|
}else{
|
||||||
throw new \UnexpectedValueException("Unknown map object type");
|
throw new \UnexpectedValueException("Unknown map object type $object->type");
|
||||||
}
|
}
|
||||||
$this->trackedEntities[] = $object;
|
$this->trackedEntities[] = $object;
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ class ClientboundMapItemDataPacket extends DataPacket{
|
|||||||
}elseif($object->type === MapTrackedObject::TYPE_ENTITY){
|
}elseif($object->type === MapTrackedObject::TYPE_ENTITY){
|
||||||
$this->putEntityUniqueId($object->entityUniqueId);
|
$this->putEntityUniqueId($object->entityUniqueId);
|
||||||
}else{
|
}else{
|
||||||
throw new \UnexpectedValueException("Unknown map object type");
|
throw new \InvalidArgumentException("Unknown map object type $object->type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,12 +61,20 @@ abstract class DataPacket extends NetworkBinaryStream{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \OutOfBoundsException
|
||||||
|
* @throws \UnexpectedValueException
|
||||||
|
*/
|
||||||
public function decode() : void{
|
public function decode() : void{
|
||||||
$this->rewind();
|
$this->rewind();
|
||||||
$this->decodeHeader();
|
$this->decodeHeader();
|
||||||
$this->decodePayload();
|
$this->decodePayload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \OutOfBoundsException
|
||||||
|
* @throws \UnexpectedValueException
|
||||||
|
*/
|
||||||
protected function decodeHeader() : void{
|
protected function decodeHeader() : void{
|
||||||
$pid = $this->getUnsignedVarInt();
|
$pid = $this->getUnsignedVarInt();
|
||||||
if($pid !== static::NETWORK_ID){
|
if($pid !== static::NETWORK_ID){
|
||||||
@ -76,6 +84,9 @@ abstract class DataPacket extends NetworkBinaryStream{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Note for plugin developers: If you're adding your own packets, you should perform decoding in here.
|
* Note for plugin developers: If you're adding your own packets, you should perform decoding in here.
|
||||||
|
*
|
||||||
|
* @throws \OutOfBoundsException
|
||||||
|
* @throws \UnexpectedValueException
|
||||||
*/
|
*/
|
||||||
protected function decodePayload() : void{
|
protected function decodePayload() : void{
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ class SetScorePacket extends DataPacket{
|
|||||||
$this->putString($entry->customName);
|
$this->putString($entry->customName);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new \UnexpectedValueException("Unknown entry type $entry->type");
|
throw new \InvalidArgumentException("Unknown entry type $entry->type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,7 @@ class NetworkInventoryAction{
|
|||||||
* @param Player $player
|
* @param Player $player
|
||||||
*
|
*
|
||||||
* @return InventoryAction|null
|
* @return InventoryAction|null
|
||||||
|
*
|
||||||
* @throws \UnexpectedValueException
|
* @throws \UnexpectedValueException
|
||||||
*/
|
*/
|
||||||
public function createInventoryAction(Player $player) : ?InventoryAction{
|
public function createInventoryAction(Player $player) : ?InventoryAction{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user