mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 11:58:00 +00:00
Introduce support for Translatable disconnection messages
this allows localizing disconnection screens (at least, once #4512 has been addressed) and the disconnect reasons shown on the console. We already had disconnect messages implicitly localized in a few places, so this is just formalizing it. This does break BC with any code that previously passed translation keys as the disconnect screen message, because they'll no longer be translated (only Translatables will be translatated now).
This commit is contained in:
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\network;
|
||||
|
||||
use pocketmine\lang\Translatable;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
use function count;
|
||||
use function spl_object_id;
|
||||
@@ -74,7 +75,7 @@ class NetworkSessionManager{
|
||||
/**
|
||||
* Terminates all connected sessions with the given reason.
|
||||
*/
|
||||
public function close(string $reason = "") : void{
|
||||
public function close(Translatable|string $reason = "") : void{
|
||||
foreach($this->sessions as $session){
|
||||
$session->disconnect($reason);
|
||||
}
|
||||
|
Reference in New Issue
Block a user