Skip to content

Commit

Permalink
feat: add amount arg to item-give command
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Dec 1, 2023
1 parent 2a14260 commit b4c8b7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ internal class GearyCommands : IdofrontCommandExecutor(), TabCompleter {
val prefabKey by optionArg(options = gearyItems.prefabs.run { toList { it.key.toString() } }) {
parseErrorMessage = { "No such entity: $passed" }
}
val amount by intArg { default = 1 }
playerAction {
val item = gearyItems.createItem(PrefabKey.of(prefabKey)) ?: run {
sender.error("Failed to spawn $prefabKey")
return@playerAction
}
item.amount = amount.coerceIn(1, 64)
player.inventory.addItem(item)
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kotlin.code.style=official
group=com.mineinabyss
version=0.27
idofrontVersion=0.20.6
idofrontVersion=0.20.14
gearyVersion=0.23-SNAPSHOT

0 comments on commit b4c8b7b

Please sign in to comment.