ToolRegistrationEvent

class ToolRegistrationEvent(val registry: ToolRegistry) : 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
}

Constructors

Link copied to clipboard
constructor(registry: ToolRegistry)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
@get:NotNull
open val eventName: @NotNull String
Link copied to clipboard
open override val handlers: HandlerList
Link copied to clipboard
Link copied to clipboard

The registry instance used to manage and register tools.

Functions

Link copied to clipboard
open fun callEvent(): Boolean
Link copied to clipboard
open override fun getHandlers(): HandlerList