mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 20:44:05 +09:00
Object-ified console commands (singleton!)
Former-commit-id: d04fc939a659fc4a6b952d64894bd28edf97bc38 Former-commit-id: 6c20526f3bdda2d9d08dc156b3b0fe271e89bffb
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user