Localize gamemode command errors

This commit is contained in:
Dylan K. Taylor
2021-10-02 21:22:54 +01:00
parent 30e10c38b6
commit fb570970a8
5 changed files with 18 additions and 4 deletions

View File

@ -53,7 +53,7 @@ class DefaultGamemodeCommand extends VanillaCommand{
$gameMode = GameMode::fromString($args[0]);
if($gameMode === null){
$sender->sendMessage("Unknown game mode");
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_gamemode_unknown($args[0]));
return true;
}

View File

@ -55,7 +55,7 @@ class GamemodeCommand extends VanillaCommand{
$gameMode = GameMode::fromString($args[0]);
if($gameMode === null){
$sender->sendMessage("Unknown game mode");
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_gamemode_unknown($args[0]));
return true;
}
@ -74,7 +74,7 @@ class GamemodeCommand extends VanillaCommand{
$target->setGamemode($gameMode);
if(!$gameMode->equals($target->getGamemode())){
$sender->sendMessage("Game mode change for " . $target->getName() . " failed!");
$sender->sendMessage(KnownTranslationFactory::pocketmine_command_gamemode_failure($target->getName()));
}else{
if($target === $sender){
Command::broadcastCommandMessage($sender, KnownTranslationFactory::commands_gamemode_success_self($gameMode->getTranslatableName()));