Localized remaining disconnection screens (except one or two that should never actually happen)

This commit is contained in:
Dylan K. Taylor
2022-12-27 20:05:59 +00:00
parent 6b8b7311f0
commit 7ac6bd79a9
16 changed files with 486 additions and 43 deletions

View File

@@ -26,6 +26,7 @@ namespace pocketmine\event\player;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\event\Event;
use pocketmine\lang\KnownTranslationFactory;
use pocketmine\lang\Translatable;
use pocketmine\network\mcpe\NetworkSession;
@@ -36,12 +37,14 @@ use pocketmine\network\mcpe\NetworkSession;
class PlayerDuplicateLoginEvent extends Event implements Cancellable{
use CancellableTrait;
private Translatable|string $disconnectMessage = "Logged in from another location";
private Translatable|string $disconnectMessage;
public function __construct(
private NetworkSession $connectingSession,
private NetworkSession $existingSession
){}
){
$this->disconnectMessage = KnownTranslationFactory::disconnectionScreen_loggedinOtherLocation();
}
public function getConnectingSession() : NetworkSession{
return $this->connectingSession;

View File

@@ -25,6 +25,7 @@ namespace pocketmine\event\player;
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;
use pocketmine\lang\Translatable;
use pocketmine\player\Player;
/**
@@ -37,7 +38,7 @@ class PlayerTransferEvent extends PlayerEvent implements Cancellable{
Player $player,
protected string $address,
protected int $port,
protected string $message
protected Translatable|string $message
){
$this->player = $player;
}
@@ -73,14 +74,14 @@ class PlayerTransferEvent extends PlayerEvent implements Cancellable{
/**
* Returns the disconnect reason shown in the server log and on the console.
*/
public function getMessage() : string{
public function getMessage() : Translatable|string{
return $this->message;
}
/**
* Sets the disconnect reason shown in the server log and on the console.
*/
public function setMessage(string $message) : void{
public function setMessage(Translatable|string $message) : void{
$this->message = $message;
}
}