Added KnownTranslationKeys (generated) and start using it

This commit is contained in:
Dylan K. Taylor
2021-06-29 22:46:04 +01:00
parent f02817bcd3
commit 94e16f416d
57 changed files with 802 additions and 286 deletions

View File

@@ -26,6 +26,7 @@ namespace pocketmine\command\defaults;
use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\command\utils\InvalidCommandSyntaxException;
use pocketmine\lang\KnownTranslationKeys;
use pocketmine\lang\TranslationContainer;
use pocketmine\permission\DefaultPermissionNames;
use pocketmine\player\Player;
@@ -40,8 +41,8 @@ class SpawnpointCommand extends VanillaCommand{
public function __construct(string $name){
parent::__construct(
$name,
"%pocketmine.command.spawnpoint.description",
"%commands.spawnpoint.usage"
"%" . KnownTranslationKeys::POCKETMINE_COMMAND_SPAWNPOINT_DESCRIPTION,
"%" . KnownTranslationKeys::COMMANDS_SPAWNPOINT_USAGE
);
$this->setPermission(DefaultPermissionNames::COMMAND_SPAWNPOINT);
}
@@ -64,7 +65,7 @@ class SpawnpointCommand extends VanillaCommand{
}else{
$target = $sender->getServer()->getPlayerByPrefix($args[0]);
if($target === null){
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.player.notFound"));
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%" . KnownTranslationKeys::COMMANDS_GENERIC_PLAYER_NOTFOUND));
return true;
}
@@ -78,7 +79,7 @@ class SpawnpointCommand extends VanillaCommand{
$z = $this->getRelativeDouble($pos->z, $sender, $args[3]);
$target->setSpawn(new Position($x, $y, $z, $world));
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.spawnpoint.success", [$target->getName(), round($x, 2), round($y, 2), round($z, 2)]));
Command::broadcastCommandMessage($sender, new TranslationContainer(KnownTranslationKeys::COMMANDS_SPAWNPOINT_SUCCESS, [$target->getName(), round($x, 2), round($y, 2), round($z, 2)]));
return true;
}elseif(count($args) <= 1){
@@ -87,7 +88,7 @@ class SpawnpointCommand extends VanillaCommand{
$pos = Position::fromObject($cpos->floor(), $cpos->getWorld());
$target->setSpawn($pos);
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.spawnpoint.success", [$target->getName(), round($pos->x, 2), round($pos->y, 2), round($pos->z, 2)]));
Command::broadcastCommandMessage($sender, new TranslationContainer(KnownTranslationKeys::COMMANDS_SPAWNPOINT_SUCCESS, [$target->getName(), round($pos->x, 2), round($pos->y, 2), round($pos->z, 2)]));
return true;
}else{
$sender->sendMessage(TextFormat::RED . "Please provide a player!");