Class MessageProcessor

java.lang.Object
de.marcely.bedwars.api.message.MessageProcessor

public abstract class MessageProcessor extends Object
Handles the post-processing of a message.

Its tasks (at least for the default processor) are:
- Replacing placeholders
- Replacing message placeholders
- Replacing chat color codes
- Adding a prefix to the message

See Also:
  • Constructor Details

    • MessageProcessor

      public MessageProcessor()
  • Method Details

    • getPlugin

      public abstract Plugin getPlugin()
      Returns the plugin that's owning this processor
      Returns:
      The plugin that created this processor
    • isDefault

      public final boolean isDefault()
      Returns if it's the MessageProcessor provided by MBedwars
      Returns:
      true if it's the MessageProcessor provided by MBedwars
    • process

      public abstract String process(String rawMessage, Message messageObj, @Nullable @Nullable String locale)
      The default processor processes it in the following way:
      1. Get the message in the language of the sender
      2. Replace the message placeholders (these which are surrounded with a %)
      3. Replaces the placeholders (these which are surrounded with { and })
      4. Replaces the chat color codes
      Parameters:
      rawMessage - The message that was fetched from the Message object you can work with
      messageObj - The Message object that contains informations about the object
      locale - The locale of the target. Keep in mind that rawMessage has already been translated into the given locale
      Returns:
      The final String
    • process

      public String process(@Nullable @Nullable CommandSender target, Message messageObj, boolean forceDefaultLang)
      Same as process(String, Message, String) put fetches the locale from the given target
      Parameters:
      target - Will fetch the locale from this target. May be null
      messageObj - Contains info about the message
      forceDefaultLang - true means that it should use the default language independent of the configuration of the user
      Returns:
      The final String