mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 08:19:45 +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);
|
||||
break;
|
||||
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){
|
||||
$object->entityUniqueId = $this->getEntityUniqueId();
|
||||
}else{
|
||||
throw new \UnexpectedValueException("Unknown map object type");
|
||||
throw new \UnexpectedValueException("Unknown map object type $object->type");
|
||||
}
|
||||
$this->trackedEntities[] = $object;
|
||||
}
|
||||
@ -163,7 +163,7 @@ class ClientboundMapItemDataPacket extends DataPacket{
|
||||
}elseif($object->type === MapTrackedObject::TYPE_ENTITY){
|
||||
$this->putEntityUniqueId($object->entityUniqueId);
|
||||
}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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \OutOfBoundsException
|
||||
* @throws \UnexpectedValueException
|
||||
*/
|
||||
public function decode() : void{
|
||||
$this->rewind();
|
||||
$this->decodeHeader();
|
||||
$this->decodePayload();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \OutOfBoundsException
|
||||
* @throws \UnexpectedValueException
|
||||
*/
|
||||
protected function decodeHeader() : void{
|
||||
$pid = $this->getUnsignedVarInt();
|
||||
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.
|
||||
*
|
||||
* @throws \OutOfBoundsException
|
||||
* @throws \UnexpectedValueException
|
||||
*/
|
||||
protected function decodePayload() : void{
|
||||
|
||||
|
@ -81,7 +81,7 @@ class SetScorePacket extends DataPacket{
|
||||
$this->putString($entry->customName);
|
||||
break;
|
||||
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
|
||||
*
|
||||
* @return InventoryAction|null
|
||||
*
|
||||
* @throws \UnexpectedValueException
|
||||
*/
|
||||
public function createInventoryAction(Player $player) : ?InventoryAction{
|
||||
|
Loading…
x
Reference in New Issue
Block a user