Console commands now write to stdout directly, instead of being fed through the logger

this has a number of implications:
- Console command outputs are now (obviously) not logged. This is consistent with every other type of command sender, be it RCON, players, or anything else.
- The assumption that the console command sender must be able to see the logger output is now broken, since the command sender can receive output separately from the logs.

In the future, it might be desirable to send the console command output to stderr instead of stdout, so that stdout can be silenced while still allowing commands to be used.

closes #2543
This commit is contained in:
Dylan K. Taylor
2022-09-27 21:02:49 +01:00
parent 83e5b0adb6
commit cfb0cad7e0
2 changed files with 4 additions and 4 deletions

View File

@ -27,7 +27,6 @@ declare(strict_types=1);
namespace pocketmine\command;
use pocketmine\command\utils\CommandException;
use pocketmine\console\ConsoleCommandSender;
use pocketmine\lang\KnownTranslationFactory;
use pocketmine\lang\Translatable;
use pocketmine\permission\PermissionManager;
@ -228,7 +227,7 @@ abstract class Command{
$result = KnownTranslationFactory::chat_type_admin($source->getName(), $message);
$colored = $result->prefix(TextFormat::GRAY . TextFormat::ITALIC);
if($sendToSource && !($source instanceof ConsoleCommandSender)){
if($sendToSource){
$source->sendMessage($message);
}