mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 16:59:44 +00:00
Terminal: Added write() and writeLine() to allow easily emitting Minecraft-formatted text to the console
This commit is contained in:
parent
4e5a80c481
commit
eedea4998b
@ -307,7 +307,7 @@ class MainLogger extends \AttachableThreadedLogger{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->synchronized(function() use ($message, $level, $time) : void{
|
$this->synchronized(function() use ($message, $level, $time) : void{
|
||||||
echo Terminal::toANSI($message) . PHP_EOL;
|
Terminal::writeLine($message);
|
||||||
|
|
||||||
foreach($this->attachments as $attachment){
|
foreach($this->attachments as $attachment){
|
||||||
$attachment->call($level, $message);
|
$attachment->call($level, $message);
|
||||||
|
@ -263,4 +263,23 @@ abstract class Terminal{
|
|||||||
|
|
||||||
return $newString;
|
return $newString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emits a string containing Minecraft colour codes to the console formatted with native colours.
|
||||||
|
*
|
||||||
|
* @param string $line
|
||||||
|
*/
|
||||||
|
public static function write(string $line) : void{
|
||||||
|
echo self::toANSI($line);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emits a string containing Minecraft colour codes to the console formatted with native colours, followed by a
|
||||||
|
* newline character.
|
||||||
|
*
|
||||||
|
* @param string $line
|
||||||
|
*/
|
||||||
|
public static function writeLine(string $line) : void{
|
||||||
|
echo self::toANSI($line) . PHP_EOL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user