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

@ -2081,14 +2081,14 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
/**
* Transfers a player to another server.
*
* @param string $address The IP address or hostname of the destination server
* @param int $port The destination port, defaults to 19132
* @param string $message Message to show in the console when closing the player
* @param string $address The IP address or hostname of the destination server
* @param int $port The destination port, defaults to 19132
* @param Translatable|string|null $message Message to show in the console when closing the player, null will use the default message
*
* @return bool if transfer was successful.
*/
public function transfer(string $address, int $port = 19132, string $message = "transfer") : bool{
$ev = new PlayerTransferEvent($this, $address, $port, $message);
public function transfer(string $address, int $port = 19132, Translatable|string|null $message = null) : bool{
$ev = new PlayerTransferEvent($this, $address, $port, $message ?? KnownTranslationFactory::pocketmine_disconnect_transfer());
$ev->call();
if(!$ev->isCancelled()){
$this->getNetworkSession()->transfer($ev->getAddress(), $ev->getPort(), $ev->getMessage());
@ -2303,7 +2303,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
public function respawn() : void{
if($this->server->isHardcore()){
if($this->kick("You have been banned because you died in hardcore mode")){ //this allows plugins to prevent the ban by cancelling PlayerKickEvent
if($this->kick(KnownTranslationFactory::pocketmine_disconnect_ban(KnownTranslationFactory::pocketmine_disconnect_ban_hardcore()))){ //this allows plugins to prevent the ban by cancelling PlayerKickEvent
$this->server->getNameBans()->addBan($this->getName(), "Died in hardcore mode");
}
return;