First look at separating disconnect reason and disconnect screen messages (#4512)

This commit is contained in:
Dylan K. Taylor
2023-01-18 20:57:17 +00:00
parent 365cce9d0c
commit b8f6b66e42
7 changed files with 111 additions and 45 deletions

View File

@@ -96,10 +96,13 @@ class NetworkSessionManager{
/**
* Terminates all connected sessions with the given reason.
*
* @param Translatable|string $reason Shown in the server log - this should be a short one-line message
* @param Translatable|string|null $disconnectScreenMessage Shown on the player's disconnection screen (null will use the reason)
*/
public function close(Translatable|string $reason = "") : void{
public function close(Translatable|string $reason = "", Translatable|string|null $disconnectScreenMessage = null) : void{
foreach($this->sessions as $session){
$session->disconnect($reason);
$session->disconnect($reason, $disconnectScreenMessage);
}
$this->sessions = [];
}