Add tests for remaining commands

This commit is contained in:
Gary Tierney
2018-09-04 03:51:26 +01:00
parent 20bb420916
commit 5f49ec16a2
5 changed files with 233 additions and 7 deletions
+15 -4
View File
@@ -35,16 +35,27 @@ on_command("spawn", PrivilegeLevel.ADMINISTRATOR)
if (arguments.size == 1) {
position = player.position
} else {
var height = player.position.height
if (arguments.size == 4) {
val x = Ints.tryParse(arguments[1])
val y = Ints.tryParse(arguments[2])
if (x == null || y == null) {
player.sendMessage(invalidSyntax)
return@then
}
val height = if (arguments.size == 4) {
val h = Ints.tryParse(arguments[3])
if (h == null) {
player.sendMessage(invalidSyntax)
return@then
}
height = h
h
} else {
player.position.height
}
position = Position(arguments[1].toInt(), arguments[2].toInt(), height)
position = Position(x, y, height)
}
player.world.register(Npc(player.world, id, position))