TranslationContainer: added prefix(), postfix() and format()

This commit is contained in:
Dylan K. Taylor
2021-08-14 16:08:22 +01:00
parent 13d4131d0d
commit 804d02b086
17 changed files with 46 additions and 49 deletions

View File

@ -81,7 +81,6 @@ use pocketmine\item\Item;
use pocketmine\item\ItemUseResult;
use pocketmine\item\Releasable;
use pocketmine\lang\KnownTranslationFactory;
use pocketmine\lang\KnownTranslationKeys;
use pocketmine\lang\Language;
use pocketmine\lang\TranslationContainer;
use pocketmine\math\Vector3;
@ -321,9 +320,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
public function getLeaveMessage() : TranslationContainer|string{
if($this->spawned){
return new TranslationContainer(TextFormat::YELLOW . "%" . KnownTranslationKeys::MULTIPLAYER_PLAYER_LEFT, [
$this->getDisplayName()
]);
return KnownTranslationFactory::multiplayer_player_left($this->getDisplayName())->prefix(TextFormat::YELLOW);
}
return "";
@ -757,9 +754,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
});
$ev = new PlayerJoinEvent($this,
new TranslationContainer(TextFormat::YELLOW . "%" . KnownTranslationKeys::MULTIPLAYER_PLAYER_JOINED, [
$this->getDisplayName()
])
KnownTranslationFactory::multiplayer_player_joined($this->getDisplayName())->prefix(TextFormat::YELLOW)
);
$ev->call();
if($ev->getJoinMessage() !== ""){