Package org.incendo.cloud.caption
Interface CaptionRegistry<C>
- Type Parameters:
C- command sender type
- All Known Implementing Classes:
CaptionRegistryImpl
Registry that allows for messages to be configurable per-sender. Delegates to registered
CaptionProviders.-
Method Summary
Modifier and TypeMethodDescriptionReturns the value of the givencaptionfor the givensender.static <C> CaptionRegistry<C> Creates a new caption registry with no providers registered.registerProvider(@NonNull CaptionProvider<C> provider) Registers the givenprovider.
-
Method Details
-
caption
Returns the value of the givencaptionfor the givensender.- Parameters:
caption- the caption keysender- the sender to get the caption for- Returns:
- the caption value
-
registerProvider
Registers the givenprovider.When
caption(Caption, Object)is invoked, all providers will be iterated over (with the last registered provider getting priority) until a provider returns a non-nullvalue for the caption.You may use
CaptionProvider.forCaption(Caption, Function)to register per-caption providers, orCaptionProvider.constantProvider(Caption, String)to register constant values.- Parameters:
provider- the provider- Returns:
this
-
captionRegistry
Creates a new caption registry with no providers registered.- Type Parameters:
C- command sender type- Returns:
- new caption registry
-