Interface MessageAPI
-
Method Summary
Modifier and TypeMethodDescriptionstatic MessageAPI
get()
Returns the global MessageAPI instance.Returns the default PlayerLocaleFetcher initiated by the MBedwars pluginReturns all registered default mappings (This won't include the MBedwars' one).Returns the default MessageProcessor initiated by the MBedwars pluginGet the active instance that fetches the locale of a player.A MessageProcessor overtakes the post processing of a message.Returns all locales that are currently in memory.
Keep in mind that this may vary depending on the configuration of the user.
Does not include the default oneboolean
A mapping contains a collection of messages that'll be used when the user tries to obtain a message from his messages file that is however not present.void
setLocaleFetcher
(PlayerLocaleFetcher fetcher) Set the active instance that fetches the locale of a player.void
setProcessor
(MessageProcessor processor) A MessageProcessor overtakes the post processing of a message.boolean
Unregisteres an already registered mapping.
-
Method Details
-
getProcessor
MessageProcessor getProcessor()A MessageProcessor overtakes the post processing of a message.This includes: replacing placeholders, message placeholders and replacing chat color codes.
The methodMessage.done()
passes a message to the current set processor- Returns:
- The current set processor
-
setProcessor
A MessageProcessor overtakes the post processing of a message.This includes: replacing placeholders, message placeholders and replacing chat color codes.
The methodMessage.done()
passes a message to the current set processor- Parameters:
processor
- The new processor
-
getDefaultProcessor
MessageProcessor getDefaultProcessor()Returns the default MessageProcessor initiated by the MBedwars plugin- Returns:
- The default processor
-
getLocaleFetcher
PlayerLocaleFetcher getLocaleFetcher()Get the active instance that fetches the locale of a player.The locale is used to translate messages into the language of the player, if activated by the server-admin.
- Returns:
- The current set fetcher
-
setLocaleFetcher
Set the active instance that fetches the locale of a player.The locale is used to translate messages into the language of the player, if activated by the server-admin.
- Parameters:
fetcher
- The new fetcher
-
getDefaultLocaleFetcher
PlayerLocaleFetcher getDefaultLocaleFetcher()Returns the default PlayerLocaleFetcher initiated by the MBedwars plugin- Returns:
- The default fetcher
-
getStoredLocales
Returns all locales that are currently in memory.
Keep in mind that this may vary depending on the configuration of the user.
Does not include the default one- Returns:
- The locales stored in memory
-
registerDefaultMappings
A mapping contains a collection of messages that'll be used when the user tries to obtain a message from his messages file that is however not present.This class is helpful for plugins that want to retain the users ability to customize the message. MBedwars will automatically unregister the mappings when the plugin is not loaded anymore.
- Parameters:
mappings
- The mappings that shall be registered- Returns:
true
if wasn't already present
-
unregisterDefaultMappings
Unregisteres an already registered mapping.- Parameters:
mappings
- The mappings that shall be registered- Returns:
true
if it has been found and unregistered
-
getDefaultMappings
Collection<DefaultMessageMappings> getDefaultMappings()Returns all registered default mappings (This won't include the MBedwars' one).- Returns:
- All registered mappings
-
get
Returns the global MessageAPI instance.- Returns:
- The global MessageAPI instance
-