Package de.marcely.bedwars.api.message
Class PlayerLocaleFetcher
java.lang.Object
de.marcely.bedwars.api.message.PlayerLocaleFetcher
Used to fetch the locale of a player.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract @Nullable LocaleFetches the locale of a player.@Nullable StringfetchAsString(Player player) Fetches the locale in Java's Locale String format (e.g.abstract PluginReturns the plugin that's owning this instancefinal booleanReturns if it's the PlayerLocaleFetcher provided by MBedwars
-
Constructor Details
-
PlayerLocaleFetcher
public PlayerLocaleFetcher()
-
-
Method Details
-
getPlugin
Returns the plugin that's owning this instance- Returns:
- The plugin that created this instance
-
isDefault
public final boolean isDefault()Returns if it's the PlayerLocaleFetcher provided by MBedwars- Returns:
trueif it's the PlayerLocaleFetcher provided by MBedwars
-
fetch
Fetches the locale of a player.The default configured locale will be used if null is returned. It might also fallback to the default configured if the returned locale is not configured or if multi-language support has been disabled by the server-admin.
- Parameters:
player- The player to fetch the locale from- Returns:
- The locale of the player or
nullif the player has no locale
-
fetchAsString
Fetches the locale in Java's Locale String format (e.g. "en_US").It is recommended to implement this as well for performance reasons, if the locale is already stored in this format. The reason why it exists separately is that Minecraft's clients send the locale in this format.
- Parameters:
player- The player to fetch the locale from- Returns:
- The locale of the player in
Locale.toString()format ornullif the player has no locale
-