Interface MessageAPI


public interface MessageAPI
Contains API for the process of messages and languages.
  • 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 method Message.done() passes a message to the current set processor

      Returns:
      The current set processor
    • setProcessor

      void setProcessor(MessageProcessor processor)
      A MessageProcessor overtakes the post processing of a message.

      This includes: replacing placeholders, message placeholders and replacing chat color codes.
      The method Message.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

      void setLocaleFetcher(PlayerLocaleFetcher fetcher)
      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

      Set<String> 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

      boolean registerDefaultMappings(DefaultMessageMappings mappings)
      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

      boolean unregisterDefaultMappings(DefaultMessageMappings mappings)
      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

      static MessageAPI get()
      Returns the global MessageAPI instance.
      Returns:
      The global MessageAPI instance