Package com.kamikazejam.kamicommon.util
Class MessageBuilder
java.lang.Object
com.kamikazejam.kamicommon.util.MessageBuilder
A utility class for sending building messages built from a config.
The primary function of this class is to grab either a string or string list from the config.
It will detect which one to use and the server owner can configure it as either.
The secondary function of this class is to send messages translated, and with PAPI placeholders replaced
The primary function of this class is to grab either a string or string list from the config.
It will detect which one to use and the server owner can configure it as either.
The secondary function of this class is to send messages translated, and with PAPI placeholders replaced
-
Constructor Summary
ConstructorsConstructorDescriptionMessageBuilder
(KamiConfig config, String key) Creates a new MessageBuilder from a configuration keyMessageBuilder
(ConfigurationSection section, String key) Creates a new MessageBuilder from a configuration keyMessageBuilder
(String message) Creates a new MessageBuilder from a stringMessageBuilder
(String... lines) Creates a new MessageBuilder from a list of stringsMessageBuilder
(Collection<String> lines) Creates a new MessageBuilder from a list of stringsMessageBuilder
(ConfigurationSection config, String key) Creates a new MessageBuilder from a configuration keyMessageBuilder
(FileConfiguration config, String key) Creates a new MessageBuilder from a configuration key -
Method Summary
Modifier and TypeMethodDescriptionstatic MessageBuilder
of
(KamiConfig config, String key) static MessageBuilder
of
(ConfigurationSection section, String key) static MessageBuilder
static MessageBuilder
static MessageBuilder
static MessageBuilder
of
(ConfigurationSection config, String key) static MessageBuilder
of
(FileConfiguration config, String key) Replaces all instances of a string with another stringreplaceLine
(String find, List<String> replacement) Searches for the find placeholder in the text, and replaces that entire line with replacementsend
(@NotNull List<CommandSender> senders) Sends the message to a CommandSendersend
(@NotNull CommandSender sender) Sends the message to a CommandSendersend
(@NotNull CommandSender... senders) Sends the message to a CommandSenderSends the message to a CommandSenderSends the message to a CommandSendersendAll()
Sends the message to all Online Players (and console)sendAll
(boolean consoleToo) Sends the message to all Online Players
-
Constructor Details
-
MessageBuilder
Creates a new MessageBuilder from a string- Parameters:
message
- The message to send
-
MessageBuilder
Creates a new MessageBuilder from a list of strings- Parameters:
lines
- The lines to send
-
MessageBuilder
Creates a new MessageBuilder from a list of strings- Parameters:
lines
- The lines to send
-
MessageBuilder
Creates a new MessageBuilder from a configuration key- Parameters:
section
- The section to search the key inkey
- The key pointing to the message. This class will detect if the key points to a string or a list of strings, and then handle things accordingly.
-
MessageBuilder
Creates a new MessageBuilder from a configuration key- Parameters:
config
- The KamiConfig to search the key inkey
- The key pointing to the message. This class will detect if the key points to a string or a list of strings, and then handle things accordingly.
-
MessageBuilder
Creates a new MessageBuilder from a configuration key- Parameters:
config
- The ConfigurationSection to search the key inkey
- The key pointing to the message. This class will detect if the key points to a string or a list of strings, and then handle things accordingly.
-
MessageBuilder
Creates a new MessageBuilder from a configuration key- Parameters:
config
- The FileConfiguration to search the key inkey
- The key pointing to the message. This class will detect if the key points to a string or a list of strings, and then handle things accordingly.
-
-
Method Details
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
replace
Replaces all instances of a string with another string- Parameters:
key
- The string to replacevalue
- The string to replace it with- Returns:
- The MessageBuilder instance (for chaining)
-
replaceLine
Searches for the find placeholder in the text, and replaces that entire line with replacement- Parameters:
find
- The string to search for in the lorereplacement
- The lines to swap in, in place of the entire line containing find- Returns:
- The MessageBuilder with replaced lore
-
send
Sends the message to a CommandSender- Parameters:
sender
- The CommandSender to send the message to- Returns:
- The MessageBuilder instance (for chaining)
-
send
Sends the message to a CommandSender- Parameters:
senders
- The CommandSender to send the message to- Returns:
- The MessageBuilder instance (for chaining)
-
send
Sends the message to a CommandSender- Parameters:
senders
- The CommandSender to send the message to- Returns:
- The MessageBuilder instance (for chaining)
-
send
Sends the message to a CommandSender- Parameters:
player
- The Player to send the message to- Returns:
- The MessageBuilder instance (for chaining)
-
send
Sends the message to a CommandSender- Parameters:
players
- The Player(s) to send the message to- Returns:
- The MessageBuilder instance (for chaining)
-
sendAll
Sends the message to all Online Players- Parameters:
consoleToo
- If true, the message will also be sent to the console
-
sendAll
Sends the message to all Online Players (and console)
-