diff --git a/src/Server.php b/src/Server.php index bce3d1a68..ad23df82b 100644 --- a/src/Server.php +++ b/src/Server.php @@ -1194,10 +1194,9 @@ class Server{ } /** - * @param TranslationContainer|string $message * @param CommandSender[]|null $recipients */ - public function broadcastMessage($message, ?array $recipients = null) : int{ + public function broadcastMessage(TranslationContainer|string $message, ?array $recipients = null) : int{ $recipients = $recipients ?? $this->getBroadcastChannelSubscribers(self::BROADCAST_CHANNEL_USERS); foreach($recipients as $recipient){ diff --git a/src/command/Command.php b/src/command/Command.php index 9ba5fd16c..c7ce225c8 100644 --- a/src/command/Command.php +++ b/src/command/Command.php @@ -231,10 +231,7 @@ abstract class Command{ $this->usageMessage = $usage; } - /** - * @param TranslationContainer|string $message - */ - public static function broadcastCommandMessage(CommandSender $source, $message, bool $sendToSource = true) : void{ + public static function broadcastCommandMessage(CommandSender $source, TranslationContainer|string $message, bool $sendToSource = true) : void{ $users = $source->getServer()->getBroadcastChannelSubscribers(Server::BROADCAST_CHANNEL_ADMINISTRATIVE); if($message instanceof TranslationContainer){ $formatted = "[" . $source->getName() . ": " . ($source->getLanguage()->get($message->getText()) !== $message->getText() ? "%" : "") . $message->getText() . "]"; diff --git a/src/command/CommandSender.php b/src/command/CommandSender.php index 3c19565fe..0776a614f 100644 --- a/src/command/CommandSender.php +++ b/src/command/CommandSender.php @@ -32,10 +32,7 @@ interface CommandSender extends Permissible{ public function getLanguage() : Language; - /** - * @param TranslationContainer|string $message - */ - public function sendMessage($message) : void; + public function sendMessage(TranslationContainer|string $message) : void; public function getServer() : Server; diff --git a/src/console/ConsoleCommandSender.php b/src/console/ConsoleCommandSender.php index eba16586a..219ecb2af 100644 --- a/src/console/ConsoleCommandSender.php +++ b/src/console/ConsoleCommandSender.php @@ -58,10 +58,7 @@ class ConsoleCommandSender implements CommandSender{ return $this->language; } - /** - * @param TranslationContainer|string $message - */ - public function sendMessage($message) : void{ + public function sendMessage(TranslationContainer|string $message) : void{ $server = $this->getServer(); if($message instanceof TranslationContainer){ $message = $this->getLanguage()->translate($message); diff --git a/src/event/player/PlayerDeathEvent.php b/src/event/player/PlayerDeathEvent.php index 0886a3652..b3d55dc13 100644 --- a/src/event/player/PlayerDeathEvent.php +++ b/src/event/player/PlayerDeathEvent.php @@ -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; } diff --git a/src/event/player/PlayerJoinEvent.php b/src/event/player/PlayerJoinEvent.php index 30a46065b..56900874b 100644 --- a/src/event/player/PlayerJoinEvent.php +++ b/src/event/player/PlayerJoinEvent.php @@ -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; } } diff --git a/src/event/player/PlayerKickEvent.php b/src/event/player/PlayerKickEvent.php index a31e9e1da..4119d18b8 100644 --- a/src/event/player/PlayerKickEvent.php +++ b/src/event/player/PlayerKickEvent.php @@ -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; } } diff --git a/src/event/player/PlayerQuitEvent.php b/src/event/player/PlayerQuitEvent.php index 4fe6bf71f..84beece22 100644 --- a/src/event/player/PlayerQuitEvent.php +++ b/src/event/player/PlayerQuitEvent.php @@ -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; } diff --git a/src/player/Player.php b/src/player/Player.php index d27726295..e33399690 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -319,10 +319,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ } } - /** - * @return TranslationContainer|string - */ - public function getLeaveMessage(){ + public function getLeaveMessage() : TranslationContainer|string{ if($this->spawned){ return new TranslationContainer(TextFormat::YELLOW . "%" . KnownTranslationKeys::MULTIPLAYER_PLAYER_LEFT, [ $this->getDisplayName() @@ -1782,10 +1779,8 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ /** * Sends a direct chat message to a player - * - * @param TranslationContainer|string $message */ - public function sendMessage($message) : void{ + public function sendMessage(TranslationContainer|string $message) : void{ if($message instanceof TranslationContainer){ $this->sendTranslation($message->getText(), $message->getParameters()); return; @@ -1883,10 +1878,8 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ /** * Kicks a player from the server - * - * @param TranslationContainer|string|null $quitMessage */ - public function kick(string $reason = "", $quitMessage = null) : bool{ + public function kick(string $reason = "", TranslationContainer|string|null $quitMessage = null) : bool{ $ev = new PlayerKickEvent($this, $reason, $quitMessage ?? $this->getLeaveMessage()); $ev->call(); if(!$ev->isCancelled()){ @@ -1914,7 +1907,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ * @param string $reason Shown to the player, usually this will appear on their disconnect screen. * @param TranslationContainer|string|null $quitMessage Message to broadcast to online players (null will use default) */ - public function disconnect(string $reason, $quitMessage = null) : void{ + public function disconnect(string $reason, TranslationContainer|string|null $quitMessage = null) : void{ if(!$this->isConnected()){ return; } @@ -1930,7 +1923,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ * @param string $reason Shown to the player, usually this will appear on their disconnect screen. * @param TranslationContainer|string|null $quitMessage Message to broadcast to online players (null will use default) */ - public function onPostDisconnect(string $reason, $quitMessage) : void{ + public function onPostDisconnect(string $reason, TranslationContainer|string|null $quitMessage) : void{ if($this->isConnected()){ throw new \InvalidStateException("Player is still connected"); }