feat: Add command argument to apply components with a specific tier level.

This commit is contained in:
Kariya 2025-12-10 13:17:07 +00:00
parent 2f441e334d
commit 9bb631df74

View File

@ -164,6 +164,35 @@ object CommandRegistrar {
component.apply(item)
sender.sendMessage("Applied component '${component.displayName}' to held item.")
}
integer("tier", min = 1, max = 100) {
executes {
val sender = sender
if (sender !is Player) {
sender.sendMessage("Only players can use this command.")
return@executes
}
val item = sender.inventory.itemInMainHand
if (item.type.isAir) {
sender.sendMessage("You must be holding an item.")
return@executes
}
val componentId = argument<String>("componentId")
val tierLevel = argument<Int>("tier")
val component = ComponentRegistry.getAll()
.find { it.key.key == componentId }
if (component == null) {
sender.sendMessage("Unknown component: $componentId")
return@executes
}
val tier = Tier.fromLevel(tierLevel)
component.apply(item, tier)
sender.sendMessage("Applied component '${component.displayName}' (Tier ${tier.level}) to held item.")
}
}
}
}