Class AudienceLocaleExtractor<C>
java.lang.Object
org.incendo.cloud.translations.minecraft.extras.AudienceLocaleExtractor<C>
- All Implemented Interfaces:
Function<C,,@Nullable Locale> LocaleExtractor<C>
@DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class)
public final class AudienceLocaleExtractor<C>
extends Object
implements LocaleExtractor<C>, Function<C,@Nullable Locale>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.incendo.cloud.translations.LocaleExtractor
LocaleExtractor.Builder<C extends Object> -
Method Summary
Modifier and TypeMethodDescriptionstatic <C extends Audience>
AudienceLocaleExtractor<C>Returns a locale extractor that uses thelocale pointerto extract aLocalefrom the sender.static <C> AudienceLocaleExtractor<C>audienceLocaleExtractor(AudienceProvider<C> audienceProvider) Returns a locale extractor that uses thelocale pointerto extract aLocalefrom the sender as an audience as mapped byaudienceProvider.defaulted(@NonNull LocaleExtractor<C> fallback) Returns a copy of this extractor that falls back to the provided extractor when thelocale pointerdoes not have a value for a given audience.
-
Method Details
-
audienceLocaleExtractor
public static <C> AudienceLocaleExtractor<C> audienceLocaleExtractor(AudienceProvider<C> audienceProvider) Returns a locale extractor that uses thelocale pointerto extract aLocalefrom the sender as an audience as mapped byaudienceProvider.- Type Parameters:
C- command sender type- Parameters:
audienceProvider- audience provider- Returns:
- extractor
-
audienceLocaleExtractor
Returns a locale extractor that uses thelocale pointerto extract aLocalefrom the sender.- Type Parameters:
C- command sender type- Returns:
- extractor
-
extract
- Specified by:
extractin interfaceLocaleExtractor<C>
-
apply
-
defaulted
Returns a copy of this extractor that falls back to the provided extractor when thelocale pointerdoes not have a value for a given audience.Note that this only applies to
extract(Object).apply(Object)will always returnnullwhen the pointer does not have a value, as it is meant for use withLocaleExtractor.Builder- Parameters:
fallback- fallback extractor- Returns:
- defaulted extractor
-