Tool Registration Event
Event triggered to allow the registration of custom tools into the tool registry.
This event provides access to the ToolRegistry, enabling plugins or other components to register their custom tools during the server's initialization phase. Tools added to the registry are then available for execution throughout the system.
The ToolRegistrationEvent is typically fired during the server's startup sequence or during specific plugin initialization routines. Once the event is dispatched, listeners can interact with the provided registry to add tools by invoking the register method with instances of io.fletchly.comparator.model.tool.Tool
Samples
import io.fletchly.comparator.annotation.ToolFunction
import io.fletchly.comparator.event.ToolRegistrationEvent
import io.fletchly.comparator.tool.tool
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
fun main() {
//sampleStart
@ToolFunction("some_tool", "handles something")
fun someHandler() = "handled"
val someTool = tool(::someHandler)
class SomeListener: Listener {
@EventHandler
fun onToolRegistration(event: ToolRegistrationEvent) {
event.registry.register(someTool)
}
}
//sampleEnd
}