rewrite negative integer amounts to 1

This commit is contained in:
Beck 2026-06-09 01:48:12 -07:00
parent cd14fbcc30
commit d708b065fc

View file

@ -67,7 +67,7 @@ class SpawnCommandSet : CommandSet(Privilege.ADMIN){
return@define
}
val id = args[1].toIntOrNull() ?: return@define
var amount = args.getOrNull(2)?.toIntOrNull() ?: 1
var amount = args.getOrNull(2)?.toIntOrNull()?.takeIf { it > 0 } ?: 1
if (id > Cache.getItemDefinitionsSize()) {
reject(player,"Item ID '$id' out of range.")
return@define