Merge pull request #387 from Major-/kotlin-experiments-pos

Improve ::position command message
This commit is contained in:
Major
2018-03-28 19:44:07 +01:00
committed by GitHub
2 changed files with 13 additions and 6 deletions
+6 -5
View File
@@ -1,12 +1,13 @@
plugin { plugin {
name = "chat_commands" name = "chat_commands"
authors = [ authors = [
"Graham", "Graham",
"Major", "Major",
"lare96", "lare96",
"cubeee", "cubeee",
] ]
dependencies = [ dependencies = [
"util:command", "api",
"util:command",
] ]
} }
+7 -1
View File
@@ -2,13 +2,19 @@ import com.google.common.primitives.Ints
import org.apollo.game.model.Position import org.apollo.game.model.Position
import org.apollo.game.model.entity.setting.PrivilegeLevel import org.apollo.game.model.entity.setting.PrivilegeLevel
import org.apollo.game.plugin.util.command.valid_arg_length import org.apollo.game.plugin.util.command.valid_arg_length
import org.apollo.game.plugins.api.component1
import org.apollo.game.plugins.api.component2
import org.apollo.game.plugins.api.component3
/** /**
* Sends the player's position. * Sends the player's position.
*/ */
on_command("pos", PrivilegeLevel.MODERATOR) on_command("pos", PrivilegeLevel.MODERATOR)
.then { player -> .then { player ->
player.sendMessage("You are at: ${player.position}.") val (x, y, z) = player.position
val region = player.position.regionCoordinates
player.sendMessage("You are at: ($x, $y, $z) in region (${region.x}, ${region.y}).")
} }
/** /**