public class MessageManager extends Object
message.yml
file.Constructor and Description |
---|
MessageManager() |
Modifier and Type | Method and Description |
---|---|
static List<String> |
getLayout(Object file,
String path,
String... parameters)
Get the layout (basically just a string list) from the given path in the given file.
The parameters work as described in sendMessage(Object, String, boolean, String...) . |
static String |
getMessage(String path,
boolean prefix,
String... parameters)
Get the message from the given path.
The parameters work as described in sendMessage(Object, String, boolean, String...) . |
static String |
getMessage(String path,
String... parameters)
Get the message from the given path.
The parameters work as described in sendMessage(Object, String, boolean, String...) . |
static void |
sendMessage(Object receiver,
String path,
boolean prefix,
String... parameters)
Send message from the given path directly to the given receiver.
How the parameters work:
The amount of parameters given has to be an even number as the parameters are interpreted in pairs.The first parameter is the String to search for and the second one is the one it will be replaced with. Same goes for the third and fourth and for the fifth and sixth and so on. e.g.: getMessage("some.path", "NAME", "Leoko", "ID", "#342") will get the message located at
"some.path" and replace each %NAME% with Leoko and each %ID% with #342. |
public static String getMessage(String path, String... parameters)
sendMessage(Object, String, boolean, String...)
.path
- the pathparameters
- the parameterspublic static String getMessage(String path, boolean prefix, String... parameters)
sendMessage(Object, String, boolean, String...)
.path
- the pathprefix
- whether to prepend a prefix (can be overridden by the DisablePrefix option)parameters
- the parameterspublic static List<String> getLayout(Object file, String path, String... parameters)
sendMessage(Object, String, boolean, String...)
.file
- the file (see MethodInterface.getConfig()
, MethodInterface.getMessages()
,
MethodInterface.getLayouts()
)path
- the pathparameters
- the parameterspublic static void sendMessage(Object receiver, String path, boolean prefix, String... parameters)
parameters
work:
The amount of parameters given has to be an even number as the parameters are interpreted in pairs.getMessage("some.path", "NAME", "Leoko", "ID", "#342")
will get the message located at
"some.path" and replace each %NAME% with Leoko and each %ID% with #342.receiver
- the receiver (Bukkit or Bungeecord player object)path
- the pathprefix
- whether to use the global prefixparameters
- the parametersCopyright © 2020. All rights reserved.