Object-ified console commands (singleton!)

Former-commit-id: d04fc939a659fc4a6b952d64894bd28edf97bc38
Former-commit-id: 6c20526f3bdda2d9d08dc156b3b0fe271e89bffb
This commit is contained in:
Song Minjae
2016-12-14 00:28:09 +09:00
parent e1642c799c
commit 22bb5d83e1
38 changed files with 204 additions and 214 deletions

View File

@@ -33,7 +33,7 @@ object CommandInterpreter {
fun execute(command: String) {
val cmd: Array<CommandInput?> = parse(command)
val echo = Echo()
val error = Error()
for (single_command in cmd) {
@@ -46,7 +46,7 @@ object CommandInterpreter {
commandObj = CommandDict[single_command.name.toLowerCase()]
}
else {
if (Terrarum.ingame.auth.b()) {
if (Authenticator.b()) {
commandObj = CommandDict[single_command.name.toLowerCase()]
}
else {
@@ -59,7 +59,7 @@ object CommandInterpreter {
}
finally {
echo.execute("$ccW> $single_command") // prints out the input
Echo.execute("$ccW> $single_command") // prints out the input
println("${ZonedDateTime.now()} [CommandInterpreter] issuing command '$single_command'")
try {
if (commandObj != null) {
@@ -73,7 +73,7 @@ object CommandInterpreter {
catch (e: Exception) {
System.err.print("[CommandInterpreter] ")
e.printStackTrace()
error.execute(Lang["ERROR_GENERIC_TEXT"])
Error.execute(Lang["ERROR_GENERIC_TEXT"])
}
}
@@ -115,7 +115,7 @@ object CommandInterpreter {
val sb = StringBuilder()
val formatter = Formatter(sb)
Error().execute(
Error.execute(
formatter.format(Lang["DEV_MESSAGE_CONSOLE_COMMAND_UNKNOWN"], cmdname).toString())
}