PocketMine-MP 5.21.2 git-09bf203267aca9b83a09640e17bfac0fc7b58ff8
Loading...
Searching...
No Matches
PlayStatusPacket.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::PLAY_STATUS_PACKET;
21
22 public const LOGIN_SUCCESS = 0;
23 public const LOGIN_FAILED_CLIENT = 1;
24 public const LOGIN_FAILED_SERVER = 2;
25 public const PLAYER_SPAWN = 3;
26 public const LOGIN_FAILED_INVALID_TENANT = 4;
27 public const LOGIN_FAILED_VANILLA_EDU = 5;
28 public const LOGIN_FAILED_EDU_VANILLA = 6;
29 public const LOGIN_FAILED_SERVER_FULL = 7;
30 public const LOGIN_FAILED_EDITOR_VANILLA = 8;
31 public const LOGIN_FAILED_VANILLA_EDITOR = 9;
32
33 public int $status;
34
38 public static function create(int $status) : self{
39 $result = new self;
40 $result->status = $status;
41 return $result;
42 }
43
44 protected function decodePayload(PacketSerializer $in) : void{
45 $this->status = $in->getInt();
46 }
47
48 public function canBeSentBeforeLogin() : bool{
49 return true;
50 }
51
52 protected function encodePayload(PacketSerializer $out) : void{
53 $out->putInt($this->status);
54 }
55
56 public function handle(PacketHandlerInterface $handler) : bool{
57 return $handler->handlePlayStatus($this);
58 }
59}