Package dev.majek.pc.chat
Class MessageHandler
- java.lang.Object
-
- dev.majek.pc.chat.MessageHandler
-
- Direct Known Subclasses:
PartyChatCommand,PartyCommand
public class MessageHandler extends Object
Handles all plugin messages.
-
-
Constructor Summary
Constructors Constructor Description MessageHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsendFormattedMessage(org.bukkit.command.CommandSender sender, String message)This will apply PlaceholderAPI placeholders and then parse the message to a Component using ChatParser.voidsendMessage(User user, String path)voidsendMessage(org.bukkit.command.CommandSender sender, String path)Send a player a message from the messages config file (this will be set to the correct language).voidsendMessageWithEverything(org.bukkit.command.CommandSender sender, String path, String target1, String replacement1, String target2, String replacement2, String toAdd)Send a message with replacements and message to send to PartyChat.voidsendMessageWithReplacement(org.bukkit.command.CommandSender sender, String path, String target, String replacement)Send a player a message from the messages config file (this will be set to the correct language) while replacing a target with a defined string.voidsendMessageWithReplacements(org.bukkit.command.CommandSender sender, String path, Map<String,String> replacements)Send a message to aCommandSenderwith multiple replacements.
-
-
-
Method Detail
-
sendFormattedMessage
public void sendFormattedMessage(org.bukkit.command.CommandSender sender, String message)This will apply PlaceholderAPI placeholders and then parse the message to a Component using ChatParser.- Parameters:
sender- The person to send the message to.message- The message to send the person.
-
sendMessage
public void sendMessage(org.bukkit.command.CommandSender sender, String path)Send a player a message from the messages config file (this will be set to the correct language). Replace the %prefix% placeholder with the defined prefix in the file.- Parameters:
sender- The player/console to send the message to.path- The path to get the message from in the file.
-
sendMessageWithReplacement
public void sendMessageWithReplacement(org.bukkit.command.CommandSender sender, String path, String target, String replacement)Send a player a message from the messages config file (this will be set to the correct language) while replacing a target with a defined string.- Parameters:
sender- The player/console to send the message to.path- The path to get the message from in the file.target- The target string to be replaced.replacement- The replacement for the target string.
-
sendMessageWithReplacements
public void sendMessageWithReplacements(org.bukkit.command.CommandSender sender, String path, Map<String,String> replacements)Send a message to aCommandSenderwith multiple replacements.- Parameters:
sender- The person to send the message to.path- The path to the message in the lang file.replacements- The map of replacements.
-
sendMessageWithEverything
public void sendMessageWithEverything(org.bukkit.command.CommandSender sender, String path, String target1, String replacement1, String target2, String replacement2, String toAdd)Send a message with replacements and message to send to PartyChat.- Parameters:
sender- Player/console to send the message to.path- Path to get from messages config file.target1- First placeholder to find and replace.replacement1- Replacement for first placeholder.target2- Second placeholder to find and replace.replacement2- Replacement for second placeholder.toAdd- Message to add to the end of everything.
-
-