relocate comments

This commit is contained in:
Dylan K. Taylor 2023-01-08 20:56:51 +00:00
parent 81ca0c8fbf
commit d2eddf9d33
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 2 additions and 2 deletions

View File

@ -933,9 +933,9 @@ class NetworkSession{
public function onChatMessage(Translatable|string $message) : void{
if($message instanceof Translatable){
//we can't send nested translations to the client, so make sure they are always pre-translated by the server
$language = $this->player->getLanguage();
if(!$this->server->isLanguageForced()){
//we can't send nested translations to the client, so make sure they are always pre-translated by the server
$parameters = array_map(fn(string|Translatable $p) => $p instanceof Translatable ? $language->translate($p) : $p, $message->getParameters());
$this->sendDataPacket(TextPacket::translation($language->translateString($message->getText(), $parameters, "pocketmine."), $parameters));
}else{

View File

@ -52,9 +52,9 @@ class DeathPacketHandler extends PacketHandler{
/** @var string[] $parameters */
$parameters = [];
if($this->deathMessage instanceof Translatable){
//we can't send nested translations to the client, so make sure they are always pre-translated by the server
$language = $this->player->getLanguage();
if(!$this->player->getServer()->isLanguageForced()){
//we can't send nested translations to the client, so make sure they are always pre-translated by the server
$parameters = array_map(fn(string|Translatable $p) => $p instanceof Translatable ? $language->translate($p) : $p, $this->deathMessage->getParameters());
$message = $language->translateString($this->deathMessage->getText(), $parameters, "pocketmine.");
}else{