Interface Message
- All Superinterfaces:
- Cloneable
     By this, you're e.g. able to work with messages from the messages file or able to easily replace placeholders / chatcolors etc.
     Start with build(String), buildByKey(String) or buildByKey(String, String)
 
- 
Method SummaryModifier and TypeMethodDescriptionstatic MessageCreates an instance of a message.static MessageCreates an instance of a message that persists of multiple lines.static MessageCreates an instance of a message that persists of multiple lines.static MessagebuildByKey(String key) Creates an instance of a message.static MessagebuildByKey(String key, String def) Creates an instance of a message.voidRemoves all previously added placeholders to this instance.clone()Clones an exact replica.Clones the current Message and creates a non-freeable variant.default Stringdone()Will put the message into the MessageProccessor and returns the result.default Stringdone(boolean freeInstance) Will put the message into the MessageProccessor and returns its result.default Stringdone(@Nullable RemotePlayer sender) Same asdone(RemotePlayer, boolean)and puts this instance automatically back into the pooldone(@Nullable RemotePlayer sender, boolean freeInstance) Will put the message into the MessageProccessor and returns its result.default Stringdone(@Nullable CommandSenderWrapper sender) Same asdone(CommandSenderWrapper, boolean)and puts this instance automatically back into the pooldone(@Nullable CommandSenderWrapper sender, boolean freeInstance) Will put the message into the MessageProccessor and returns its result.default StringSame asdone(String, boolean)and puts this instance automatically back into the poolSame asdone(CommandSender, boolean).default Stringdone(@Nullable CommandSender sender) Same asdone(CommandSender, boolean)and puts this instance automatically back into the pooldone(@Nullable CommandSender sender, boolean freeInstance) Will put the message into the MessageProccessor and returns its result.booleanfree()Messages are stored in a pool to reduce memory usage.@Nullable StringReturns the default string in case no matching message has been found by the key.Get the string that has been inserted.@Nullable StringgetPlaceholder(String key) Obtains the value of a placeholder that has been previously added.getRawMessage(@Nullable String locale) This method is essential for the message processor.booleanisFreed()Returns whether the Message instance has been put back to the pool or not.default Messageplaceholder(String key, Object value) Adds a placeholder to the message.placeholder(String key, String value) Adds a placeholder to the message.default voidsend(RemotePlayer sender) Computes it and sends it to the personvoidsend(RemotePlayer sender, boolean freeInstance) Computes it and sends it to the persondefault voidsend(CommandSenderWrapper sender) Computes it and sends it to the personvoidsend(CommandSenderWrapper sender, boolean freeInstance) Computes it and sends it to the persondefault voidsend(CommandSender sender) Computes it and sends it to the personvoidsend(CommandSender sender, boolean freeInstance) Computes it and sends it to the person
- 
Method Details- 
getRawMessageThis method is essential for the message processor. It returns the String that shall be processed- Parameters:
- locale- Tries to find the message in the given locale. If it doesn't find any or if locale=null then it'll pick the default one
- Returns:
- The raw/unformatted message
 
- 
getInputStringString getInputString()Get the string that has been inserted.The string can later be parsed to the same message using build(String). It may does not match *exactly* when this instance has been constructed i.a.buildByKey(String). In that case, it is being surrounded with % signs, to make it parseable bybuild(String).- Returns:
- The input string that has been inserted during the construction of this instance
 
- 
getDefaultStringReturns the default string in case no matching message has been found by the key.This only applies when buildByKey(String, String)has been used.- Returns:
- The default string. nullif none is being used
 
- 
placeholderAdds a placeholder to the message.It'll later reformat it from {key} to the value. - Parameters:
- key- The name of the placeholder
- value- What the placeholder represents
- Returns:
- This instance
 
- 
placeholderAdds a placeholder to the message.It'll later reformat it from {key} to the value. - Parameters:
- key- The name of the placeholder
- value- What the placeholder represents
- Returns:
- This instance
 
- 
getPlaceholderObtains the value of a placeholder that has been previously added.- Parameters:
- key- The key of the placeholder
- Returns:
- Its value. nullif it hasn't been added yet
 
- 
clearPlaceholdersvoid clearPlaceholders()Removes all previously added placeholders to this instance.
- 
doneWill put the message into the MessageProccessor and returns its result.Message instances are stored in a pool to decrease memory usage. 
 By that they must be putten back when not used anymore. Or in other words: set "freeInstance" to false when you want to store this instance inside the memoryThis method also automatically replaces PAPI placeholders, in case this feature is enabled the user. - Parameters:
- sender- Will take his language, otherwise the default language when null
- freeInstance- If it should put this instance back into the pool or not
- Returns:
- The final String
 
- 
doneSame asdone(CommandSender, boolean)and puts this instance automatically back into the pool- Parameters:
- sender- Will take his language, otherwise the default language when null
- Returns:
- The final String
 
- 
doneWill put the message into the MessageProccessor and returns its result.Message instances are stored in a pool to decrease memory usage. 
 By that they must be putten back when not used anymore. Or in other words: set "freeInstance" to false when you want to store this instance inside the memoryThis method also automatically replaces PAPI placeholders, in case this feature is enabled the user. - Parameters:
- sender- Will take his language, otherwise the default language when null
- freeInstance- If it should put this instance back into the pool or not
- Returns:
- The final String
 
- 
doneSame asdone(RemotePlayer, boolean)and puts this instance automatically back into the pool- Parameters:
- sender- Will take his language, otherwise the default language when null
- Returns:
- The final String
 
- 
doneWill put the message into the MessageProccessor and returns its result.Message instances are stored in a pool to decrease memory usage. 
 By that they must be putten back when not used anymore. Or in other words: set "freeInstance" to false when you want to store this instance inside the memoryThis method also automatically replaces PAPI placeholders, in case this feature is enabled the user. - Parameters:
- sender- Will take his language, otherwise the default language when null
- freeInstance- If it should put this instance back into the pool or not
- Returns:
- The final String
 
- 
doneSame asdone(CommandSenderWrapper, boolean)and puts this instance automatically back into the pool- Parameters:
- sender- Will take his language, otherwise the default language when null
- Returns:
- The final String
 
- 
doneSame asdone(CommandSender, boolean).We will fallback to the default language if the locale is not found. See MessageAPI.getStoredLocales()to see a list of all available locales.- Parameters:
- locale- The name of the locale that shall be used
- freeInstance- If it should put this instance back into the pool or not
- Returns:
- The final String
 
- 
doneSame asdone(String, boolean)and puts this instance automatically back into the pool- Parameters:
- locale- The name of the locale that shall be used
- Returns:
- The final String
 
- 
doneWill put the message into the MessageProccessor and returns its result.Message instances are stored in a pool to decrease memory usage. 
 By that they must be putten back when not used anymore. Or in other words: set "freeInstance" to false when you want to store this instance inside the memoryThis method also automatically replaces PAPI placeholders, in case this feature is enabled the user. - Parameters:
- freeInstance- If it should put this instance back into the pool or not
- Returns:
- The final String
 
- 
doneWill put the message into the MessageProccessor and returns the result.Does the same as done(CommandSender), but passes null as sender.
 Also puts this instance automatically back into the pool- Returns:
- The final String
 
- 
sendComputes it and sends it to the person- Parameters:
- sender- The target
 
- 
sendComputes it and sends it to the person- Parameters:
- sender- The target
 
- 
sendComputes it and sends it to the person- Parameters:
- sender- The target
 
- 
sendComputes it and sends it to the person- Parameters:
- sender- The target
- freeInstance- If it should put this instance back into the pool or not
 
- 
sendComputes it and sends it to the person- Parameters:
- sender- The target
- freeInstance- If it should put this instance back into the pool or not
 
- 
sendComputes it and sends it to the person- Parameters:
- sender- The target
- freeInstance- If it should put this instance back into the pool or not
 
- 
freeboolean free()Messages are stored in a pool to reduce memory usage. Invoke this method when you're done using it and want to put it back manually.
 Keep in mind that the methodsdone()anddone(CommandSender)automatically are putting this instance back into memory unless told otherwise using the parameter "freeInstance".- Returns:
- falseif it's already in the pool
 
- 
isFreedboolean isFreed()Returns whether the Message instance has been put back to the pool or not.- Returns:
- If it has been freed by now
 
- 
cloneNonUpcyableMessage cloneNonUpcyable()Clones the current Message and creates a non-freeable variant.You may use it in sensible parts where you want to make sure that the instance 100% doesn't get freed at any moment. - Returns:
- A new instance that can't be put back into the pool
 
- 
cloneMessage clone()Clones an exact replica.- Returns:
- A cloned instance
 
- 
buildCreates an instance of a message.It's being taken from a pool for greater performance. 
 Make sure that you won't use the instance after you randone()ordone(CommandSender). Otherwise the system will break.- Parameters:
- rawMessage- The raw/unformatted message containing the placeholders, color codes etc.
- Returns:
- An instance of Message to pass parameters
 
- 
buildCreates an instance of a message that persists of multiple lines.It's being taken from a pool for greater performance. 
 Make sure that you won't use the instance after you randone()ordone(CommandSender). Otherwise the system will break.- Parameters:
- lines- The lines in a raw/unformatted format containing the placeholders, color codes etc.
- Returns:
- An instance of Message to pass parameters
 
- 
buildCreates an instance of a message that persists of multiple lines.It's being taken from a pool for greater performance. 
 Make sure that you won't use the instance after you randone()ordone(CommandSender). Otherwise the system will break.- Parameters:
- lines- The lines in a raw/unformatted format containing the placeholders, color codes etc.
- Returns:
- An instance of Message to pass parameters
 
- 
buildByKeyCreates an instance of a message.It's being taken from a pool for greater performance. Make sure that you won't reuse the instance after you ran done()ordone(CommandSender). Otherwise the system will break.
 The difference to thebuild(String)method is that this one will first try to get the key from the messages file. It'll use the given def String if it hasn't been found.- Parameters:
- key- Will look for this key in the messages file
- def- Uses this if it hasn't found it in the messages file
- Returns:
- An instance of Message to pass parameters
 
- 
buildByKeyCreates an instance of a message.It's being taken from a pool for greater performance. Make sure that you won't reuse the instance after you ran done()ordone(CommandSender). Otherwise the system will break.
 The difference to thebuild(String)method is that this one will first try to get the key from the messages file. It'll use the given def String if it hasn't been found
 Uses they key itself if it does not exist.- Parameters:
- key- Will look for this key in the messages file
- Returns:
- An instance of Message to pass parameters
 
 
-