mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 15:41:33 +00:00
Localized remaining disconnection screens (except one or two that should never actually happen)
This commit is contained in:
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user