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
+39
View File
@@ -0,0 +1,39 @@
import com.google.common.primitives.Ints
import org.apollo.cache.def.ItemDefinition
import org.apollo.game.model.entity.setting.PrivilegeLevel
on_command("item", PrivilegeLevel.ADMINISTRATOR)
.then { player ->
val invalidSyntax = "Invalid syntax - ::item [id] [amount]"
if (!valid_arg_length(arguments, 1..2, player, invalidSyntax)) {
return@then
}
val id = Ints.tryParse(arguments[0])
if (id == null) {
player.sendMessage(invalidSyntax)
return@then
}
var amount = 1
if (arguments.size == 2) {
val amt = Ints.tryParse(arguments[1])
if (amt == null) {
player.sendMessage(invalidSyntax)
return@then
}
amount = amt
}
if (id < 0 || id >= ItemDefinition.count()) {
player.sendMessage("The item id you specified is out of bounds!")
return@then
}
if (amount < 0) {
player.sendMessage("The amount you specified is out of bounds!")
return@then
}
player.inventory.add(id, amount)
}