43 public const KICK_FLAG_PLUGIN = 0;
44 public const KICK_FLAG_SERVER_FULL = 1;
45 public const KICK_FLAG_SERVER_WHITELISTED = 2;
46 public const KICK_FLAG_BANNED = 3;
48 public const KICK_FLAG_PRIORITY = [
49 self::KICK_FLAG_PLUGIN,
50 self::KICK_FLAG_SERVER_FULL,
51 self::KICK_FLAG_SERVER_WHITELISTED,
52 self::KICK_FLAG_BANNED
59 protected array $disconnectReasons = [];
64 protected array $disconnectScreenMessages = [];
66 public function __construct(
70 protected bool $authRequired
79 return $this->playerInfo;
82 public function getIp() : string{
86 public function getPort() : int{
90 public function isAuthRequired() : bool{
91 return $this->authRequired;
94 public function setAuthRequired(
bool $v) : void{
95 $this->authRequired = $v;
105 return array_keys($this->disconnectReasons);
112 return isset($this->disconnectReasons[$flag]);
123 $this->disconnectReasons[$flag] = $disconnectReason;
124 $this->disconnectScreenMessages[$flag] = $disconnectScreenMessage ?? $disconnectReason;
134 unset($this->disconnectReasons[$flag], $this->disconnectScreenMessages[$flag]);
141 $this->disconnectReasons = [];
142 $this->disconnectScreenMessages = [];
149 return count($this->disconnectReasons) === 0;
157 return $this->disconnectReasons[$flag] ?? null;
165 return $this->disconnectScreenMessages[$flag] ?? null;
176 foreach(self::KICK_FLAG_PRIORITY as $p){
177 if(isset($this->disconnectReasons[$p])){
178 return $this->disconnectReasons[$p];
193 foreach(self::KICK_FLAG_PRIORITY as $p){
194 if(isset($this->disconnectScreenMessages[$p])){
195 return $this->disconnectScreenMessages[$p];