Package de.marcely.bedwars.api.message
Class MessageProcessor
java.lang.Object
de.marcely.bedwars.api.message.MessageProcessor
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract Plugin
Returns the plugin that's owning this processorfinal boolean
Returns if it's the MessageProcessor provided by MBedwarsabstract String
The default processor processes it in the following way:
1.process
(@Nullable CommandSender target, Message messageObj, boolean forceDefaultLang) Same asprocess(String, Message, String)
put fetches the locale from the given target
-
Constructor Details
-
MessageProcessor
public MessageProcessor()
-
-
Method Details
-
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 withmessageObj
- The Message object that contains informations about the objectlocale
- 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 asprocess(String, Message, String)
put fetches the locale from the given target- Parameters:
target
- Will fetch the locale from this target. May be nullmessageObj
- Contains info about the messageforceDefaultLang
-true
means that it should use the default language independent of the configuration of the user- Returns:
- The final String
-