RegistrablesProvider

@Since(version = "2.2")
interface RegistrablesProvider

The RegistrableProvider is a holder for all registrable objects that your plugin provides to the API. The usage for this class is the reloading process - it would be difficult to reliably unload and load back registrables by a certain plugin without a constant provider holding everything at all time.

The usage of this interface is very simple: it can be implemented anonymously and then fed to the registry at any time.

The implementation of the registry is such that upon providing a registrable provider, the registry ensures that the associated plugin is enabled and then immediately registers all the provided registrables. Upon reloading the plugin, all registrables are dropped; the registry then goes through all providers and loads the provided registrables if and only if the plugin is enabled. If not, the provided registrables are skipped.

Samples

com.roughlyunderscore.sample.RegistrablesProviderExample

Functions

Link copied to clipboard
@Since(version = "2.2")
abstract fun getAssociatedPlugin(): JavaPlugin

Retrieves the plugin associated with this provider.

Link copied to clipboard
@Since(version = "2.2")
abstract fun getProvidedRegistrables(): List<Registrable>

Retrieves all the provided registrable tokens.