1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11:
12:
13: namespace ManiaLive\Utilities;
14:
15: use ManiaLive\Config\Config;
16: use DedicatedApi\Structures\Player;
17:
18: abstract class Console
19: {
20: public static function println($string)
21: {
22: Logger::getLog('runtime')->write($string);
23: if(Config::getInstance()->verbose)
24: echo $string.PHP_EOL;
25: }
26:
27: public static function print_rln($string)
28: {
29: $line = print_r($string, true);
30: Logger::getLog('runtime')->write($line);
31: if(Config::getInstance()->verbose)
32: echo $line.PHP_EOL;
33: }
34:
35: public static function getDatestamp()
36: {
37: return date("H:i:s");
38: }
39:
40: public static function printlnFormatted($string)
41: {
42: $line = '['.self::getDatestamp().'] '.$string;
43: self::println($line);
44: }
45:
46: public static function printDebug($string)
47: {
48: if(Config::getInstance()->debug)
49: {
50: $line = '['.self::getDatestamp().'|Debug] '.$string;
51: self::println($line);
52: }
53: }
54:
55: public static function printPlayerBest(Player $player)
56: {
57: $str = array();
58: $str[] = '[Time by '.$player->login.' : '.$player->bestTime.']';
59: foreach($player->bestCheckpoints as $i => $time)
60: {
61: $str[] = ' [Checkpoint #'.$i.': '.$time.']';
62: }
63: Console::println(implode(PHP_EOL, $str));
64: }
65:
66: public static function printPlayerScore(Player $player)
67: {
68: $str = array();
69: $str[] = '[Score by '.$player->login.' : '.$player->score.']';
70: foreach($player->bestCheckpoints as $i => $score)
71: {
72: $str[] = ' [Checkpoint #'.$i.': '.$score.']';
73: }
74: Console::println(implode(PHP_EOL, $str));
75: }
76: }
77:
78: ?>