More langs :D

This commit is contained in:
Shoghi Cervantes
2015-04-11 14:59:15 +02:00
parent c2138aa30c
commit 3b6e10b759
12 changed files with 153 additions and 60 deletions

View File

@ -289,9 +289,9 @@ abstract class Command{
public static function broadcastCommandMessage(CommandSender $source, $message, $sendToSource = true){
if($message instanceof TextContainer){
$m = clone $message;
$result = "[".$source->getName().": ".$m->getText()."]";
$result = "[".$source->getName().": ".($source->getServer()->getLanguage()->get($m->getText()) !== $m->getText() ? "%" : "") . $m->getText() ."]";
$users = Server::getInstance()->getPluginManager()->getPermissionSubscriptions(Server::BROADCAST_CHANNEL_ADMINISTRATIVE);
$users = $source->getServer()->getPluginManager()->getPermissionSubscriptions(Server::BROADCAST_CHANNEL_ADMINISTRATIVE);
$colored = TextFormat::GRAY . TextFormat::ITALIC . $result;
$m->setText($result);
@ -299,7 +299,7 @@ abstract class Command{
$m->setText($colored);
$colored = clone $m;
}else{
$users = Server::getInstance()->getPluginManager()->getPermissionSubscriptions(Server::BROADCAST_CHANNEL_ADMINISTRATIVE);
$users = $source->getServer()->getPluginManager()->getPermissionSubscriptions(Server::BROADCAST_CHANNEL_ADMINISTRATIVE);
$result = new TranslationContainer("chat.type.admin", [$source->getName(), $message]);
$colored = new TranslationContainer(TextFormat::GRAY . TextFormat::ITALIC . "%chat.type.admin", [$source->getName(), $message]);
}

View File

@ -21,6 +21,7 @@
namespace pocketmine\command;
use pocketmine\event\TranslationContainer;
use pocketmine\Server;
use pocketmine\utils\MainLogger;
use pocketmine\utils\TextFormat;
@ -49,7 +50,7 @@ class FormattedCommandAlias extends Command{
if($e instanceof \InvalidArgumentException){
$sender->sendMessage(TextFormat::RED . $e->getMessage());
}else{
$sender->sendMessage(TextFormat::RED . "An internal error occurred while attempting to perform this command");
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.exception"));
$logger = $sender->getServer()->getLogger();
if($logger instanceof MainLogger){
$logger->logException($e);

View File

@ -189,7 +189,7 @@ class SimpleCommandMap implements CommandMap{
$target->execute($sender, $sentCommandLabel, $args);
}catch(\Exception $e){
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.exception"));
$this->server->getLogger()->critical("Unhandled exception executing command '" . $commandLine . "' in " . $target . ": " . $e->getMessage());
$this->server->getLogger()->critical($this->server->getLanguage()->translateString("pocketmine.command.exception", [$commandLine, (string) $target, $e->getMessage()]));
$logger = $sender->getServer()->getLogger();
if($logger instanceof MainLogger){
$logger->logException($e);
@ -232,7 +232,7 @@ class SimpleCommandMap implements CommandMap{
foreach($values as $alias => $commandStrings){
if(strpos($alias, ":") !== false or strpos($alias, " ") !== false){
$this->server->getLogger()->warning("Could not register alias " . $alias . " because it contains illegal characters");
$this->server->getLogger()->warning($this->server->getLanguage()->translateString("pocketmine.command.alias.illegal", [$alias]));
continue;
}
@ -254,7 +254,7 @@ class SimpleCommandMap implements CommandMap{
}
if(strlen($bad) > 0){
$this->server->getLogger()->warning("Could not register alias " . $alias . " because it contains commands that do not exist: " . $bad);
$this->server->getLogger()->warning($this->server->getLanguage()->translateString("pocketmine.command.alias.notFound", [$alias, $bad]));
continue;
}