mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 11:04:05 +09:00
new console command 'error' (stderr equivalent of console window)
Former-commit-id: ab54663fd64f9ae9c758f53b3f5800a5894f0db3 Former-commit-id: 7aba1585ffa45195622bb25e1c62cace474420c9
This commit is contained in:
@@ -9,18 +9,7 @@ import net.torvald.terrarum.Terrarum
|
||||
class SetTime : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
val lowercaseTime = args[1].toLowerCase()
|
||||
val timeToSet =
|
||||
if (args[1].length >= 4) {
|
||||
lowercaseTime.substringBefore('h').toInt() * WorldTime.HOUR_SEC +
|
||||
lowercaseTime.substringAfter('h').toInt() * WorldTime.MINUTE_SEC
|
||||
}
|
||||
else if (args[1].endsWith("h", true)) {
|
||||
lowercaseTime.substring(0, args[1].length - 1).toInt() * WorldTime.HOUR_SEC
|
||||
}
|
||||
else {
|
||||
lowercaseTime.toInt()
|
||||
}
|
||||
val timeToSet = WorldTime.parseTime(args[1])
|
||||
|
||||
Terrarum.game.map.worldTime.setTime(timeToSet)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user