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
56 protected array $disconnectReasons = [];
58 protected array $disconnectScreenMessages = [];
60 public function __construct(
64 protected bool $authRequired
73 return $this->playerInfo;
76 public function getIp() : string{
80 public function getPort() : int{
84 public function isAuthRequired() : bool{
85 return $this->authRequired;
88 public function setAuthRequired(
bool $v) : void{
89 $this->authRequired = $v;
98 return array_keys($this->disconnectReasons);
105 return isset($this->disconnectReasons[$flag]);
116 $this->disconnectReasons[$flag] = $disconnectReason;
117 $this->disconnectScreenMessages[$flag] = $disconnectScreenMessage ?? $disconnectReason;
127 unset($this->disconnectReasons[$flag], $this->disconnectScreenMessages[$flag]);
134 $this->disconnectReasons = [];
135 $this->disconnectScreenMessages = [];
142 return count($this->disconnectReasons) === 0;
150 return $this->disconnectReasons[$flag] ?? null;
158 return $this->disconnectScreenMessages[$flag] ?? null;
169 foreach(self::KICK_FLAG_PRIORITY as $p){
170 if(isset($this->disconnectReasons[$p])){
171 return $this->disconnectReasons[$p];
186 foreach(self::KICK_FLAG_PRIORITY as $p){
187 if(isset($this->disconnectScreenMessages[$p])){
188 return $this->disconnectScreenMessages[$p];