Interface ProvideServiceEvent<T>
- Type Parameters:
T
- The service to provide.
- All Superinterfaces:
Event
,GenericEvent<T>
,LifecycleEvent
- All Known Subinterfaces:
ProvideServiceEvent.EngineScoped<T>
,ProvideServiceEvent.GameScoped<T>
An event that allows plugins to suggest their own implementation for a given
service.
Service providers should not construct the service object
prior to selection. Instead, they should wait for if, and only if, their
service factory as supplied in suggest(Supplier)
has been called.
Further, each plugin may only supply one service provider
for each service.
It is not guaranteed that this event will fire for the indicated service for a plugin that registers this listener. This may happen if the server is configured to select a particular service, or that another plugin has already been offered the chance to provide the implementation and has done so.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Supplies a service that is scoped to the givenEngine
.static interface
-
Method Summary
Methods inherited from interface org.spongepowered.api.event.GenericEvent
paramType
Methods inherited from interface org.spongepowered.api.event.lifecycle.LifecycleEvent
game
-
Method Details
-
suggest
Provides a suggestion for the given service. This may only be called once by any given plugin for a given service and event.- Parameters:
serviceFactory
- ASupplier
that can construct the service if this service is selected
-