GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
Terminal Class Reference

Static Public Member Functions

static hasFormattingCodes ()
 
static init ()
 

Static Public Attributes

static $FORMAT_BOLD = ""
 
static $FORMAT_OBFUSCATED = ""
 
static $FORMAT_ITALIC = ""
 
static $FORMAT_UNDERLINE = ""
 
static $FORMAT_STRIKETHROUGH = ""
 
static $FORMAT_RESET = ""
 
static $COLOR_BLACK = ""
 
static $COLOR_DARK_BLUE = ""
 
static $COLOR_DARK_GREEN = ""
 
static $COLOR_DARK_AQUA = ""
 
static $COLOR_DARK_RED = ""
 
static $COLOR_PURPLE = ""
 
static $COLOR_GOLD = ""
 
static $COLOR_GRAY = ""
 
static $COLOR_DARK_GRAY = ""
 
static $COLOR_BLUE = ""
 
static $COLOR_GREEN = ""
 
static $COLOR_AQUA = ""
 
static $COLOR_RED = ""
 
static $COLOR_LIGHT_PURPLE = ""
 
static $COLOR_YELLOW = ""
 
static $COLOR_WHITE = ""
 

Static Protected Member Functions

static getFallbackEscapeCodes ()
 
static getEscapeCodes ()
 

Member Function Documentation

◆ getEscapeCodes()

static getEscapeCodes ( )
staticprotected
95  {
96  self::$FORMAT_BOLD = `tput bold`;
97  self::$FORMAT_OBFUSCATED = `tput smacs`;
98  self::$FORMAT_ITALIC = `tput sitm`;
99  self::$FORMAT_UNDERLINE = `tput smul`;
100  self::$FORMAT_STRIKETHROUGH = "\x1b[9m"; //`tput `;
101 
102  self::$FORMAT_RESET = `tput sgr0`;
103 
104  $colors = (int) `tput colors`;
105  if($colors > 8){
106  self::$COLOR_BLACK = $colors >= 256 ? `tput setaf 16` : `tput setaf 0`;
107  self::$COLOR_DARK_BLUE = $colors >= 256 ? `tput setaf 19` : `tput setaf 4`;
108  self::$COLOR_DARK_GREEN = $colors >= 256 ? `tput setaf 34` : `tput setaf 2`;
109  self::$COLOR_DARK_AQUA = $colors >= 256 ? `tput setaf 37` : `tput setaf 6`;
110  self::$COLOR_DARK_RED = $colors >= 256 ? `tput setaf 124` : `tput setaf 1`;
111  self::$COLOR_PURPLE = $colors >= 256 ? `tput setaf 127` : `tput setaf 5`;
112  self::$COLOR_GOLD = $colors >= 256 ? `tput setaf 214` : `tput setaf 3`;
113  self::$COLOR_GRAY = $colors >= 256 ? `tput setaf 145` : `tput setaf 7`;
114  self::$COLOR_DARK_GRAY = $colors >= 256 ? `tput setaf 59` : `tput setaf 8`;
115  self::$COLOR_BLUE = $colors >= 256 ? `tput setaf 63` : `tput setaf 12`;
116  self::$COLOR_GREEN = $colors >= 256 ? `tput setaf 83` : `tput setaf 10`;
117  self::$COLOR_AQUA = $colors >= 256 ? `tput setaf 87` : `tput setaf 14`;
118  self::$COLOR_RED = $colors >= 256 ? `tput setaf 203` : `tput setaf 9`;
119  self::$COLOR_LIGHT_PURPLE = $colors >= 256 ? `tput setaf 207` : `tput setaf 13`;
120  self::$COLOR_YELLOW = $colors >= 256 ? `tput setaf 227` : `tput setaf 11`;
121  self::$COLOR_WHITE = $colors >= 256 ? `tput setaf 231` : `tput setaf 15`;
122  }else{
123  self::$COLOR_BLACK = self::$COLOR_DARK_GRAY = `tput setaf 0`;
124  self::$COLOR_RED = self::$COLOR_DARK_RED = `tput setaf 1`;
125  self::$COLOR_GREEN = self::$COLOR_DARK_GREEN = `tput setaf 2`;
126  self::$COLOR_YELLOW = self::$COLOR_GOLD = `tput setaf 3`;
127  self::$COLOR_BLUE = self::$COLOR_DARK_BLUE = `tput setaf 4`;
128  self::$COLOR_LIGHT_PURPLE = self::$COLOR_PURPLE = `tput setaf 5`;
129  self::$COLOR_AQUA = self::$COLOR_DARK_AQUA = `tput setaf 6`;
130  self::$COLOR_GRAY = self::$COLOR_WHITE = `tput setaf 7`;
131  }
132  }

◆ getFallbackEscapeCodes()

static getFallbackEscapeCodes ( )
staticprotected
68  {
69  self::$FORMAT_BOLD = "\x1b[1m";
70  self::$FORMAT_OBFUSCATED = "";
71  self::$FORMAT_ITALIC = "\x1b[3m";
72  self::$FORMAT_UNDERLINE = "\x1b[4m";
73  self::$FORMAT_STRIKETHROUGH = "\x1b[9m";
74 
75  self::$FORMAT_RESET = "\x1b[m";
76 
77  self::$COLOR_BLACK = "\x1b[38;5;16m";
78  self::$COLOR_DARK_BLUE = "\x1b[38;5;19m";
79  self::$COLOR_DARK_GREEN = "\x1b[38;5;34m";
80  self::$COLOR_DARK_AQUA = "\x1b[38;5;37m";
81  self::$COLOR_DARK_RED = "\x1b[38;5;124m";
82  self::$COLOR_PURPLE = "\x1b[38;5;127m";
83  self::$COLOR_GOLD = "\x1b[38;5;214m";
84  self::$COLOR_GRAY = "\x1b[38;5;145m";
85  self::$COLOR_DARK_GRAY = "\x1b[38;5;59m";
86  self::$COLOR_BLUE = "\x1b[38;5;63m";
87  self::$COLOR_GREEN = "\x1b[38;5;83m";
88  self::$COLOR_AQUA = "\x1b[38;5;87m";
89  self::$COLOR_RED = "\x1b[38;5;203m";
90  self::$COLOR_LIGHT_PURPLE = "\x1b[38;5;207m";
91  self::$COLOR_YELLOW = "\x1b[38;5;227m";
92  self::$COLOR_WHITE = "\x1b[38;5;231m";
93  }

◆ hasFormattingCodes()

static hasFormattingCodes ( )
static
Returns
bool|null
55  {
56  if(self::$formattingCodes === null){
57  $opts = getopt("", ["enable-ansi", "disable-ansi"]);
58  if(isset($opts["disable-ansi"])){
59  self::$formattingCodes = false;
60  }else{
61  self::$formattingCodes = ((Utils::getOS() !== "win" and getenv("TERM") != "" and (!function_exists("posix_ttyname") or !defined("STDOUT") or posix_ttyname(STDOUT) !== false)) or isset($opts["enable-ansi"]));
62  }
63  }
64 
65  return self::$formattingCodes;
66  }

◆ init()

static init ( )
static
134  {
135  if(!self::hasFormattingCodes()){
136  return;
137  }
138 
139  switch(Utils::getOS()){
140  case "linux":
141  case "mac":
142  case "bsd":
143  self::getEscapeCodes();
144  return;
145 
146  case "win":
147  case "android":
148  self::getFallbackEscapeCodes();
149  return;
150  }
151 
152  //TODO: iOS
153  }

Field Documentation

◆ $COLOR_AQUA

$COLOR_AQUA = ""
static

◆ $COLOR_BLACK

$COLOR_BLACK = ""
static

◆ $COLOR_BLUE

$COLOR_BLUE = ""
static

◆ $COLOR_DARK_AQUA

$COLOR_DARK_AQUA = ""
static

◆ $COLOR_DARK_BLUE

$COLOR_DARK_BLUE = ""
static

◆ $COLOR_DARK_GRAY

$COLOR_DARK_GRAY = ""
static

◆ $COLOR_DARK_GREEN

$COLOR_DARK_GREEN = ""
static

◆ $COLOR_DARK_RED

$COLOR_DARK_RED = ""
static

◆ $COLOR_GOLD

$COLOR_GOLD = ""
static

◆ $COLOR_GRAY

$COLOR_GRAY = ""
static

◆ $COLOR_GREEN

$COLOR_GREEN = ""
static

◆ $COLOR_LIGHT_PURPLE

$COLOR_LIGHT_PURPLE = ""
static

◆ $COLOR_PURPLE

$COLOR_PURPLE = ""
static

◆ $COLOR_RED

$COLOR_RED = ""
static

◆ $COLOR_WHITE

$COLOR_WHITE = ""
static

◆ $COLOR_YELLOW

$COLOR_YELLOW = ""
static

◆ $FORMAT_BOLD

$FORMAT_BOLD = ""
static

◆ $FORMAT_ITALIC

$FORMAT_ITALIC = ""
static

◆ $FORMAT_OBFUSCATED

$FORMAT_OBFUSCATED = ""
static

◆ $FORMAT_RESET

$FORMAT_RESET = ""
static

◆ $FORMAT_STRIKETHROUGH

$FORMAT_STRIKETHROUGH = ""
static

◆ $FORMAT_UNDERLINE

$FORMAT_UNDERLINE = ""
static

The documentation for this class was generated from the following file: