PocketMine-MP 5.21.2 git-09bf203267aca9b83a09640e17bfac0fc7b58ff8
Loading...
Searching...
No Matches
LegacyTelemetryEventPacket.php
1<?php
2
3/*
4 * This file is part of BedrockProtocol.
5 * Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
6 *
7 * BedrockProtocol is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 */
12
13declare(strict_types=1);
14
15namespace pocketmine\network\mcpe\protocol;
16
18
20 public const NETWORK_ID = ProtocolInfo::LEGACY_TELEMETRY_EVENT_PACKET;
21
22 public const TYPE_ACHIEVEMENT_AWARDED = 0;
23 public const TYPE_ENTITY_INTERACT = 1;
24 public const TYPE_PORTAL_BUILT = 2;
25 public const TYPE_PORTAL_USED = 3;
26 public const TYPE_MOB_KILLED = 4;
27 public const TYPE_CAULDRON_USED = 5;
28 public const TYPE_PLAYER_DEATH = 6;
29 public const TYPE_BOSS_KILLED = 7;
30 public const TYPE_AGENT_COMMAND = 8;
31 public const TYPE_AGENT_CREATED = 9;
32 public const TYPE_PATTERN_REMOVED = 10; //???
33 public const TYPE_COMMANED_EXECUTED = 11;
34 public const TYPE_FISH_BUCKETED = 12;
35 public const TYPE_MOB_BORN = 13;
36 public const TYPE_PET_DIED = 14;
37 public const TYPE_CAULDRON_BLOCK_USED = 15;
38 public const TYPE_COMPOSTER_BLOCK_USED = 16;
39 public const TYPE_BELL_BLOCK_USED = 17;
40 public const TYPE_ACTOR_DEFINITION = 18;
41 public const TYPE_RAID_UPDATE = 19;
42 public const TYPE_PLAYER_MOVEMENT_ANOMALY = 20; //anti cheat
43 public const TYPE_PLAYER_MOVEMENT_CORRECTED = 21;
44 public const TYPE_HONEY_HARVESTED = 22;
45 public const TYPE_TARGET_BLOCK_HIT = 23;
46 public const TYPE_PIGLIN_BARTER = 24;
47
48 public int $playerRuntimeId;
49 public int $eventData;
50 public int $type;
51
52 protected function decodePayload(PacketSerializer $in) : void{
53 $this->playerRuntimeId = $in->getActorRuntimeId();
54 $this->eventData = $in->getVarInt();
55 $this->type = $in->getByte();
56
57 //TODO: nice confusing mess
58 }
59
60 protected function encodePayload(PacketSerializer $out) : void{
61 $out->putActorRuntimeId($this->playerRuntimeId);
62 $out->putVarInt($this->eventData);
63 $out->putByte($this->type);
64
65 //TODO: also nice confusing mess
66 }
67
68 public function handle(PacketHandlerInterface $handler) : bool{
69 return $handler->handleLegacyTelemetryEvent($this);
70 }
71}