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 void
sendFormattedMessage(org.bukkit.command.CommandSender sender, String message)
This will apply PlaceholderAPI placeholders and then parse the message to a Component using ChatParser.void
sendMessage(User user, String path)
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).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.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.void
sendMessageWithReplacements(org.bukkit.command.CommandSender sender, String path, Map<String,String> replacements)
Send a message to aCommandSender
with 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 aCommandSender
with 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.
-
-