mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
PlayerPreLoginEvent: New, more elegant way to control authentication requirement
Previously the only way to deal with this was to cancel the PlayerKickEvent generated by lack of authentication. Now, plugins can decide whether auth should be required for a specific player. The default is whatever xbox-auth is set to in server.properties. cc @Johnmacrocraft
This commit is contained in:
@ -42,14 +42,18 @@ use pocketmine\Player;
|
||||
class PlayerPreLoginEvent extends PlayerEvent implements Cancellable{
|
||||
/** @var string */
|
||||
protected $kickMessage;
|
||||
/** @var bool */
|
||||
protected $authRequired;
|
||||
|
||||
/**
|
||||
* @param Player $player
|
||||
* @param string $kickMessage
|
||||
* @param bool $authRequired
|
||||
*/
|
||||
public function __construct(Player $player, string $kickMessage){
|
||||
public function __construct(Player $player, string $kickMessage, bool $authRequired){
|
||||
$this->player = $player;
|
||||
$this->kickMessage = $kickMessage;
|
||||
$this->authRequired = $authRequired;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,4 +69,18 @@ class PlayerPreLoginEvent extends PlayerEvent implements Cancellable{
|
||||
public function getKickMessage() : string{
|
||||
return $this->kickMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isAuthRequired() : bool{
|
||||
return $this->authRequired;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $v
|
||||
*/
|
||||
public function setAuthRequired(bool $v) : void{
|
||||
$this->authRequired = $v;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user