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>
public interface ProvideServiceEvent<T> extends GenericEvent<T>, LifecycleEvent
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
Nested Classes Modifier and Type Interface Description static interface
ProvideServiceEvent.EngineScoped<T>
Supplies a service that is scoped to the givenEngine
.static interface
ProvideServiceEvent.GameScoped<T>
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
suggest(Supplier<T> serviceFactory)
Provides a suggestion for the given service.-
Methods inherited from interface org.spongepowered.api.event.GenericEvent
paramType
-
Methods inherited from interface org.spongepowered.api.event.lifecycle.LifecycleEvent
game
-
-