diff --git a/src/main/kotlin/net/hareworks/hcu/items/command/CommandRegistrar.kt b/src/main/kotlin/net/hareworks/hcu/items/command/CommandRegistrar.kt index 441e61f..97696d2 100644 --- a/src/main/kotlin/net/hareworks/hcu/items/command/CommandRegistrar.kt +++ b/src/main/kotlin/net/hareworks/hcu/items/command/CommandRegistrar.kt @@ -164,7 +164,36 @@ 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("componentId") + val tierLevel = argument("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.") + } + } } } }