Remove plugins.gradle and factor into common extension

This commit is contained in:
Gary Tierney
2017-09-16 18:49:06 +01:00
parent d323bcd69c
commit 36282cf81e
104 changed files with 608 additions and 408 deletions
@@ -0,0 +1,48 @@
import com.google.common.primitives.Ints
import org.apollo.game.model.Position
import org.apollo.game.model.entity.setting.PrivilegeLevel
/**
* Sends the player's position.
*/
on_command("pos", PrivilegeLevel.MODERATOR)
.then { player ->
player.sendMessage("You are at: ${player.position}.")
}
/**
* Teleports the player to the specified position.
*/
on_command("tele", PrivilegeLevel.ADMINISTRATOR)
.then { player ->
val invalidSyntax = "Invalid syntax - ::tele [x] [y] [optional-z]"
if (!valid_arg_length(arguments, 2..3, player, invalidSyntax)) {
return@then
}
val x = Ints.tryParse(arguments[0])
if (x == null) {
player.sendMessage(invalidSyntax)
return@then
}
val y = Ints.tryParse(arguments[1])
if (y == null) {
player.sendMessage(invalidSyntax)
return@then
}
var z = player.position.height
if (arguments.size == 3) {
val plane = Ints.tryParse(arguments[2])
if (plane == null) {
player.sendMessage(invalidSyntax)
return@then
}
z = plane
}
if (z in 0..4) {
player.teleport(Position(x, y, z))
}
}