mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Use native union types for TranslationContainer|string
This commit is contained in:
@ -47,7 +47,7 @@ class PlayerDeathEvent extends EntityDeathEvent{
|
||||
* @param Item[] $drops
|
||||
* @param string|TranslationContainer|null $deathMessage Null will cause the default vanilla message to be used
|
||||
*/
|
||||
public function __construct(Player $entity, array $drops, int $xp, $deathMessage){
|
||||
public function __construct(Player $entity, array $drops, int $xp, TranslationContainer|string|null $deathMessage){
|
||||
parent::__construct($entity, $drops, $xp);
|
||||
$this->deathMessage = $deathMessage ?? self::deriveMessage($entity->getDisplayName(), $entity->getLastDamageCause());
|
||||
}
|
||||
@ -63,17 +63,11 @@ class PlayerDeathEvent extends EntityDeathEvent{
|
||||
return $this->entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TranslationContainer|string
|
||||
*/
|
||||
public function getDeathMessage(){
|
||||
public function getDeathMessage() : TranslationContainer|string{
|
||||
return $this->deathMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TranslationContainer|string $deathMessage
|
||||
*/
|
||||
public function setDeathMessage($deathMessage) : void{
|
||||
public function setDeathMessage(TranslationContainer|string $deathMessage) : void{
|
||||
$this->deathMessage = $deathMessage;
|
||||
}
|
||||
|
||||
|
@ -37,27 +37,16 @@ class PlayerJoinEvent extends PlayerEvent{
|
||||
/** @var string|TranslationContainer */
|
||||
protected $joinMessage;
|
||||
|
||||
/**
|
||||
* PlayerJoinEvent constructor.
|
||||
*
|
||||
* @param TranslationContainer|string $joinMessage
|
||||
*/
|
||||
public function __construct(Player $player, $joinMessage){
|
||||
public function __construct(Player $player, TranslationContainer|string $joinMessage){
|
||||
$this->player = $player;
|
||||
$this->joinMessage = $joinMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|TranslationContainer $joinMessage
|
||||
*/
|
||||
public function setJoinMessage($joinMessage) : void{
|
||||
public function setJoinMessage(TranslationContainer|string $joinMessage) : void{
|
||||
$this->joinMessage = $joinMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|TranslationContainer
|
||||
*/
|
||||
public function getJoinMessage(){
|
||||
public function getJoinMessage() : TranslationContainer|string{
|
||||
return $this->joinMessage;
|
||||
}
|
||||
}
|
||||
|
@ -40,12 +40,7 @@ class PlayerKickEvent extends PlayerEvent implements Cancellable{
|
||||
/** @var string */
|
||||
protected $reason;
|
||||
|
||||
/**
|
||||
* PlayerKickEvent constructor.
|
||||
*
|
||||
* @param TranslationContainer|string $quitMessage
|
||||
*/
|
||||
public function __construct(Player $player, string $reason, $quitMessage){
|
||||
public function __construct(Player $player, string $reason, TranslationContainer|string $quitMessage){
|
||||
$this->player = $player;
|
||||
$this->quitMessage = $quitMessage;
|
||||
$this->reason = $reason;
|
||||
@ -59,17 +54,11 @@ class PlayerKickEvent extends PlayerEvent implements Cancellable{
|
||||
return $this->reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TranslationContainer|string $quitMessage
|
||||
*/
|
||||
public function setQuitMessage($quitMessage) : void{
|
||||
public function setQuitMessage(TranslationContainer|string $quitMessage) : void{
|
||||
$this->quitMessage = $quitMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TranslationContainer|string
|
||||
*/
|
||||
public function getQuitMessage(){
|
||||
public function getQuitMessage() : TranslationContainer|string{
|
||||
return $this->quitMessage;
|
||||
}
|
||||
}
|
||||
|
@ -36,26 +36,17 @@ class PlayerQuitEvent extends PlayerEvent{
|
||||
/** @var string */
|
||||
protected $quitReason;
|
||||
|
||||
/**
|
||||
* @param TranslationContainer|string $quitMessage
|
||||
*/
|
||||
public function __construct(Player $player, $quitMessage, string $quitReason){
|
||||
public function __construct(Player $player, TranslationContainer|string $quitMessage, string $quitReason){
|
||||
$this->player = $player;
|
||||
$this->quitMessage = $quitMessage;
|
||||
$this->quitReason = $quitReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TranslationContainer|string $quitMessage
|
||||
*/
|
||||
public function setQuitMessage($quitMessage) : void{
|
||||
public function setQuitMessage(TranslationContainer|string $quitMessage) : void{
|
||||
$this->quitMessage = $quitMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TranslationContainer|string
|
||||
*/
|
||||
public function getQuitMessage(){
|
||||
public function getQuitMessage() : TranslationContainer|string{
|
||||
return $this->quitMessage;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user