Skip to content

Commit 3443b53

Browse files
committed
Tidy exceptions
1 parent 6a26898 commit 3443b53

11 files changed

+63
-62
lines changed

src/AvailableCommandsPacket.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use pmmp\encoding\Byte;
1818
use pmmp\encoding\ByteBufferReader;
1919
use pmmp\encoding\ByteBufferWriter;
20+
use pmmp\encoding\DataDecodeException;
2021
use pmmp\encoding\LE;
2122
use pmmp\encoding\VarInt;
2223
use pocketmine\network\mcpe\protocol\serializer\CommonTypes;
@@ -28,7 +29,6 @@
2829
use pocketmine\network\mcpe\protocol\types\command\CommandOverload;
2930
use pocketmine\network\mcpe\protocol\types\command\CommandParameter;
3031
use pocketmine\network\mcpe\protocol\types\command\CommandParameterTypes as ArgTypes;
31-
use pocketmine\utils\BinaryDataException;
3232
use function array_search;
3333
use function count;
3434
use function dechex;
@@ -217,7 +217,7 @@ protected function initSoftEnumsInCommandData() : void{
217217
* @param string[] $enumValueList
218218
*
219219
* @throws PacketDecodeException
220-
* @throws BinaryDataException
220+
* @throws DataDecodeException
221221
*/
222222
protected function getEnum(array $enumValueList, ByteBufferReader $in) : CommandEnum{
223223
$enumName = CommonTypes::getString($in);
@@ -238,7 +238,7 @@ protected function getEnum(array $enumValueList, ByteBufferReader $in) : Command
238238
}
239239

240240
/**
241-
* @throws BinaryDataException
241+
* @throws DataDecodeException
242242
*/
243243
protected function getSoftEnum(ByteBufferReader $in) : CommandEnum{
244244
$enumName = CommonTypes::getString($in);
@@ -280,7 +280,7 @@ protected function putSoftEnum(CommandEnum $enum, ByteBufferWriter $out) : void{
280280
}
281281

282282
/**
283-
* @throws BinaryDataException
283+
* @throws DataDecodeException
284284
*/
285285
protected function getEnumValueIndex(int $valueCount, ByteBufferReader $in) : int{
286286
if($valueCount < 256){
@@ -307,7 +307,7 @@ protected function putEnumValueIndex(int $index, int $valueCount, ByteBufferWrit
307307
* @param string[] $enumValues
308308
*
309309
* @throws PacketDecodeException
310-
* @throws BinaryDataException
310+
* @throws DataDecodeException
311311
*/
312312
protected function getEnumConstraint(array $enums, array $enumValues, ByteBufferReader $in) : CommandEnumConstraint{
313313
//wtf, what was wrong with an offset inside the enum? :(
@@ -352,7 +352,7 @@ protected function putEnumConstraint(CommandEnumConstraint $constraint, array $e
352352
* @param ChainedSubCommandData[] $allChainedSubCommandData
353353
*
354354
* @throws PacketDecodeException
355-
* @throws BinaryDataException
355+
* @throws DataDecodeException
356356
*/
357357
protected function getCommandData(array $enums, array $postfixes, array $allChainedSubCommandData, ByteBufferReader $in) : CommandData{
358358
$name = CommonTypes::getString($in);

src/CommandOutputPacket.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
use pmmp\encoding\Byte;
1818
use pmmp\encoding\ByteBufferReader;
1919
use pmmp\encoding\ByteBufferWriter;
20+
use pmmp\encoding\DataDecodeException;
2021
use pmmp\encoding\VarInt;
2122
use pocketmine\network\mcpe\protocol\serializer\CommonTypes;
2223
use pocketmine\network\mcpe\protocol\types\command\CommandOriginData;
2324
use pocketmine\network\mcpe\protocol\types\command\CommandOutputMessage;
24-
use pocketmine\utils\BinaryDataException;
2525
use function count;
2626

2727
class CommandOutputPacket extends DataPacket implements ClientboundPacket{
@@ -54,7 +54,7 @@ protected function decodePayload(ByteBufferReader $in) : void{
5454
}
5555

5656
/**
57-
* @throws BinaryDataException
57+
* @throws DataDecodeException
5858
*/
5959
protected function getCommandMessage(ByteBufferReader $in) : CommandOutputMessage{
6060
$message = new CommandOutputMessage();

src/DataPacket.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use pmmp\encoding\ByteBufferWriter;
1919
use pmmp\encoding\DataDecodeException;
2020
use pmmp\encoding\VarInt;
21-
use pocketmine\utils\BinaryDataException;
2221
use function get_class;
2322

2423
abstract class DataPacket implements Packet{
@@ -78,7 +77,7 @@ protected function decodeHeader(ByteBufferReader $in) : void{
7877
* Decodes the packet body, without the packet ID or other generic header fields.
7978
*
8079
* @throws PacketDecodeException
81-
* @throws BinaryDataException
80+
* @throws DataDecodeException
8281
*/
8382
abstract protected function decodePayload(ByteBufferReader $in) : void;
8483

src/MoveActorDeltaPacket.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
use pmmp\encoding\ByteBufferReader;
1818
use pmmp\encoding\ByteBufferWriter;
19+
use pmmp\encoding\DataDecodeException;
1920
use pmmp\encoding\LE;
2021
use pocketmine\network\mcpe\protocol\serializer\CommonTypes;
21-
use pocketmine\utils\BinaryDataException;
2222

2323
class MoveActorDeltaPacket extends DataPacket implements ClientboundPacket{
2424
public const NETWORK_ID = ProtocolInfo::MOVE_ACTOR_DELTA_PACKET;
@@ -42,19 +42,15 @@ class MoveActorDeltaPacket extends DataPacket implements ClientboundPacket{
4242
public float $yaw = 0.0;
4343
public float $headYaw = 0.0;
4444

45-
/**
46-
* @throws BinaryDataException
47-
*/
45+
/** @throws DataDecodeException */
4846
private function maybeReadCoord(int $flag, ByteBufferReader $in) : float{
4947
if(($this->flags & $flag) !== 0){
5048
return LE::readFloat($in);
5149
}
5250
return 0;
5351
}
5452

55-
/**
56-
* @throws BinaryDataException
57-
*/
53+
/** @throws DataDecodeException */
5854
private function maybeReadRotation(int $flag, ByteBufferReader $in) : float{
5955
if(($this->flags & $flag) !== 0){
6056
return CommonTypes::getRotationByte($in);

0 commit comments

Comments
 (0)