mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-05 17:41:46 +00:00
Add setReason() method to PlayerKickEvent
This commit is contained in:
parent
2994d0f3ae
commit
bfcef2ab6b
@ -3177,6 +3177,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
public function kick(string $reason = "", bool $isAdmin = true) : bool{
|
public function kick(string $reason = "", bool $isAdmin = true) : bool{
|
||||||
$this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, $this->getLeaveMessage()));
|
$this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, $this->getLeaveMessage()));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
|
$reason = $ev->getReason();
|
||||||
$message = $reason;
|
$message = $reason;
|
||||||
if($isAdmin){
|
if($isAdmin){
|
||||||
if(!$this->isBanned()){
|
if(!$this->isBanned()){
|
||||||
|
@ -50,6 +50,13 @@ class PlayerKickEvent extends PlayerEvent implements Cancellable{
|
|||||||
$this->reason = $reason;
|
$this->reason = $reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $reason
|
||||||
|
*/
|
||||||
|
public function setReason(string $reason) : void{
|
||||||
|
$this->reason = $reason;
|
||||||
|
}
|
||||||
|
|
||||||
public function getReason() : string{
|
public function getReason() : string{
|
||||||
return $this->reason;
|
return $this->reason;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user