Class MessageManager

java.lang.Object
com.booksaw.betterTeams.message.MessageManager

public class MessageManager extends Object
Used to control all communications to the user
Author:
booksaw
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addBackupMessages(org.bukkit.configuration.file.YamlConfiguration file)
    Used to select a file to contain backup messages in the event that the community translations are incomplete
    static void
    addMessages(@NotNull ConfigManager configManager)
    This method is used to provide the configuration file in which all the message references are stored, this method also loads the default prefix
    static void
    Used to clear all messages from the cache
    static void
    Used to clear the current MessageSender.
    static org.bukkit.configuration.file.FileConfiguration
     
     
    static @NotNull File
     
    static String
     
    static @NotNull String
    getMessage(String reference)
     
    static @NotNull String
    getMessage(String reference, Object... replacements)
    This is used to get the message from the provided location in the Configuration file, this does not add a prefix to the message
    static @NotNull String
    getMessage(org.bukkit.OfflinePlayer player, String reference, Object... replacements)
     
    Used to store all loaded messages
    static String
    This is the prefix which goes before all messages related to this plugin
    static net.kyori.adventure.text.Component
     
    static void
    sendFullMessage(Collection<? extends org.bukkit.command.CommandSender> senders, String message)
     
    static void
    sendFullMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, String message, boolean doPrefix)
    Used when sending a raw message to a group of command senders.
    static void
    sendFullMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, net.kyori.adventure.text.Component message)
     
    static void
    sendFullMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, net.kyori.adventure.text.Component message, boolean doPrefix)
     
    static void
    sendFullMessage(org.bukkit.command.CommandSender sender, String message)
    Used when you are sending a user a message instead of a message loaded from a file
    static void
    sendFullMessage(org.bukkit.command.CommandSender recipient, String message, boolean doPrefix)
    Used when you are sending a user a message instead of a message loaded from a file
    static void
    sendFullMessage(org.bukkit.command.CommandSender recipient, net.kyori.adventure.text.Component message)
     
    static void
    sendFullMessage(org.bukkit.command.CommandSender recipient, net.kyori.adventure.text.Component message, boolean doPrefix)
    Sends a full Component message to the given CommandSender
    static void
    sendFullSubTitle(Collection<org.bukkit.entity.Player> recipients, String message)
     
    static void
    sendFullSubTitle(Collection<org.bukkit.entity.Player> recipients, String message, boolean doPrefix)
     
    static void
    sendFullSubTitle(Collection<org.bukkit.entity.Player> recipients, net.kyori.adventure.text.Component message)
     
    static void
    sendFullSubTitle(Collection<org.bukkit.entity.Player> recipients, net.kyori.adventure.text.Component message, boolean doPrefix)
     
    static void
    sendFullSubTitle(org.bukkit.entity.Player recipient, String message)
     
    static void
    sendFullSubTitle(org.bukkit.entity.Player recipient, String message, boolean doPrefix)
     
    static void
    sendFullSubTitle(org.bukkit.entity.Player recipient, net.kyori.adventure.text.Component message)
     
    static void
    sendFullSubTitle(org.bukkit.entity.Player recipient, net.kyori.adventure.text.Component message, boolean doPrefix)
     
    static void
    sendFullTitle(Collection<org.bukkit.entity.Player> recipients, String message)
     
    static void
    sendFullTitle(Collection<org.bukkit.entity.Player> recipients, String message, boolean doPrefix)
     
    static void
    sendFullTitle(Collection<org.bukkit.entity.Player> recipients, net.kyori.adventure.text.Component message)
     
    static void
    sendFullTitle(Collection<org.bukkit.entity.Player> recipients, net.kyori.adventure.text.Component message, boolean doPrefix)
     
    static void
    sendFullTitle(org.bukkit.entity.Player recipient, String message)
     
    static void
    sendFullTitle(org.bukkit.entity.Player recipient, String message, boolean doPrefix)
     
    static void
    sendFullTitle(org.bukkit.entity.Player recipient, net.kyori.adventure.text.Component message)
     
    static void
    sendFullTitle(org.bukkit.entity.Player recipient, net.kyori.adventure.text.Component message, boolean doPrefix)
     
    static void
    sendFullTitleAndSub(Collection<org.bukkit.entity.Player> recipients, String title, String subTitle)
     
    static void
    sendFullTitleAndSub(Collection<org.bukkit.entity.Player> recipients, String title, String subTitle, boolean doPrefix, boolean doPrefixOnSub)
     
    static void
    sendFullTitleAndSub(Collection<org.bukkit.entity.Player> recipients, net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component subTitle)
     
    static void
    sendFullTitleAndSub(Collection<org.bukkit.entity.Player> recipients, net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component subTitle, boolean doPrefix, boolean doPrefixOnSub)
     
    static void
    sendFullTitleAndSub(org.bukkit.entity.Player recipient, String title, String subTitle)
     
    static void
    sendFullTitleAndSub(org.bukkit.entity.Player recipient, String title, String subTitle, boolean doPrefix, boolean doPrefixOnSub)
     
    static void
    sendFullTitleAndSub(org.bukkit.entity.Player recipient, net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component subTitle)
     
    static void
    sendFullTitleAndSub(org.bukkit.entity.Player recipient, net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component subTitle, boolean doPrefix, boolean doPrefixOnSub)
     
    static void
    sendMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, boolean doPrefix, String reference, Object... replacements)
     
    static void
    sendMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, @Nullable org.bukkit.OfflinePlayer player, boolean doPrefix, String reference, Object... replacements)
     
    static void
    sendMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, @Nullable org.bukkit.OfflinePlayer player, String reference, Object... replacements)
     
    static void
    sendMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, String reference, Object... replacements)
     
    static void
    sendMessage(org.bukkit.command.CommandSender recipient, boolean doPrefix, String reference, Object... replacements)
    Used to send a (formatted) message to the specified user
    static void
    sendMessage(org.bukkit.command.CommandSender recipient, @Nullable org.bukkit.OfflinePlayer player, boolean doPrefix, String reference, Object... replacements)
     
    static void
    sendMessage(org.bukkit.command.CommandSender recipient, @Nullable org.bukkit.OfflinePlayer player, String reference, Object... replacements)
     
    static void
    sendMessage(org.bukkit.command.CommandSender recipient, String reference, Object... replacements)
     
    static void
    sendSubTitle(Collection<org.bukkit.entity.Player> recipients, boolean doPrefix, String reference, Object... replacements)
     
    static void
    sendSubTitle(Collection<org.bukkit.entity.Player> recipients, @Nullable org.bukkit.OfflinePlayer player, boolean doPrefix, String reference, Object... replacements)
     
    static void
    sendSubTitle(Collection<org.bukkit.entity.Player> recipients, @Nullable org.bukkit.OfflinePlayer player, String reference, Object... replacements)
     
    static void
    sendSubTitle(Collection<org.bukkit.entity.Player> recipients, String reference, Object... replacements)
     
    static void
    sendSubTitle(org.bukkit.entity.Player recipient, boolean doPrefix, String reference, Object... replacements)
    Used to send a (formatted) subtitle to the specified user
    static void
    sendSubTitle(org.bukkit.entity.Player recipient, @Nullable org.bukkit.OfflinePlayer player, boolean doPrefix, String reference, Object... replacements)
    Used to send a (formatted) subtitle to the specified user
    static void
    sendSubTitle(org.bukkit.entity.Player recipient, @Nullable org.bukkit.OfflinePlayer player, String reference, Object... replacements)
     
    static void
    sendSubTitle(org.bukkit.entity.Player recipient, String reference, Object... replacements)
     
    static void
    sendTitle(Collection<org.bukkit.entity.Player> recipients, boolean doPrefix, String reference, Object... replacements)
     
    static void
    sendTitle(Collection<org.bukkit.entity.Player> recipients, @Nullable org.bukkit.OfflinePlayer player, boolean doPrefix, String reference, Object... replacements)
     
    static void
    sendTitle(Collection<org.bukkit.entity.Player> recipients, @Nullable org.bukkit.OfflinePlayer player, String reference, Object... replacements)
     
    static void
    sendTitle(Collection<org.bukkit.entity.Player> recipients, String reference, Object... replacements)
     
    static void
    sendTitle(org.bukkit.entity.Player recipient, boolean doPrefix, String reference, Object... replacements)
    Used to send a (formatted) title to the specified user
    static void
    sendTitle(org.bukkit.entity.Player recipient, @Nullable org.bukkit.OfflinePlayer player, boolean doPrefix, String reference, Object... replacements)
    Used to send a (formatted) title to the specified user
    static void
    sendTitle(org.bukkit.entity.Player recipient, @Nullable org.bukkit.OfflinePlayer player, String reference, Object... replacement)
     
    static void
    sendTitle(org.bukkit.entity.Player recipient, String reference, Object... replacements)
     
    static void
     
    static void
    setupMessageSender(net.kyori.adventure.platform.bukkit.BukkitAudiences audiences)
    Used to instantiate a new MessageSender.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • setupMessageSender

      @Internal public static void setupMessageSender(net.kyori.adventure.platform.bukkit.BukkitAudiences audiences)
      Used to instantiate a new MessageSender.

      Warning: This is not API, so it should never be used outside BetterTeams' package

    • dumpMessageSender

      @Internal public static void dumpMessageSender()
      Used to clear the current MessageSender.

      Warning: This is not API, so it should never be used outside BetterTeams' package

    • getLanguage

      public static String getLanguage()
    • setLanguage

      public static void setLanguage(String lang)
    • addMessages

      public static void addMessages(@NotNull @NotNull ConfigManager configManager)
      This method is used to provide the configuration file in which all the message references are stored, this method also loads the default prefix
      Parameters:
      configManager - the configuration manager
    • addBackupMessages

      public static void addBackupMessages(org.bukkit.configuration.file.YamlConfiguration file)
      Used to select a file to contain backup messages in the event that the community translations are incomplete
      Parameters:
      file - The file to load the backup messages from
    • getFile

      @Contract(value=" -> new", pure=true) @NotNull public static @NotNull File getFile()
    • getDefaultMessages

      public static org.bukkit.configuration.file.FileConfiguration getDefaultMessages()
    • dumpMessages

      public static void dumpMessages()
      Used to clear all messages from the cache
    • getMessage

      @NotNull public static @NotNull String getMessage(String reference)
    • getMessage

      @NotNull public static @NotNull String getMessage(String reference, Object... replacements)
      This is used to get the message from the provided location in the Configuration file, this does not add a prefix to the message
      Parameters:
      reference - the reference for the message
      replacements - the replacements for the {n} placeholders ( {0}, {1}, {2}, ... )
      Returns:
      the message (without prefix)
    • getMessage

      @NotNull public static @NotNull String getMessage(org.bukkit.OfflinePlayer player, String reference, Object... replacements)
    • sendMessage

      public static void sendMessage(org.bukkit.command.CommandSender recipient, String reference, Object... replacements)
    • sendMessage

      public static void sendMessage(org.bukkit.command.CommandSender recipient, boolean doPrefix, String reference, Object... replacements)
      Used to send a (formatted) message to the specified user
      Parameters:
      recipient - the commandSender which the message should be sent to
      doPrefix - if the message should have prefix
      reference - the reference for the message
      replacements - the value that the placeholder should be replaced with
    • sendMessage

      public static void sendMessage(org.bukkit.command.CommandSender recipient, @Nullable @Nullable org.bukkit.OfflinePlayer player, String reference, Object... replacements)
    • sendMessage

      public static void sendMessage(org.bukkit.command.CommandSender recipient, @Nullable @Nullable org.bukkit.OfflinePlayer player, boolean doPrefix, String reference, Object... replacements)
    • sendMessage

      public static void sendMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, String reference, Object... replacements)
    • sendMessage

      public static void sendMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, boolean doPrefix, String reference, Object... replacements)
    • sendMessage

      public static void sendMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, @Nullable @Nullable org.bukkit.OfflinePlayer player, String reference, Object... replacements)
    • sendMessage

      public static void sendMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, @Nullable @Nullable org.bukkit.OfflinePlayer player, boolean doPrefix, String reference, Object... replacements)
    • sendFullMessage

      public static void sendFullMessage(org.bukkit.command.CommandSender sender, String message)
      Used when you are sending a user a message instead of a message loaded from a file
      Parameters:
      sender - the player who sent the command
      message - the message to send to that user
    • sendFullMessage

      public static void sendFullMessage(org.bukkit.command.CommandSender recipient, String message, boolean doPrefix)
      Used when you are sending a user a message instead of a message loaded from a file
      Parameters:
      recipient - The player who sent the command
      message - The message to send to that user
      doPrefix - If a prefix should be applied
    • sendFullMessage

      public static void sendFullMessage(Collection<? extends org.bukkit.command.CommandSender> senders, String message)
    • sendFullMessage

      public static void sendFullMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, String message, boolean doPrefix)
      Used when sending a raw message to a group of command senders.
      Parameters:
      recipients -
      message -
      doPrefix -
    • sendFullMessage

      public static void sendFullMessage(org.bukkit.command.CommandSender recipient, net.kyori.adventure.text.Component message)
    • sendFullMessage

      public static void sendFullMessage(org.bukkit.command.CommandSender recipient, net.kyori.adventure.text.Component message, boolean doPrefix)
      Sends a full Component message to the given CommandSender
      Parameters:
      recipient - the target to send the message to
      message - the Adventure Component to send
    • sendFullMessage

      public static void sendFullMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, net.kyori.adventure.text.Component message)
    • sendFullMessage

      public static void sendFullMessage(Collection<? extends org.bukkit.command.CommandSender> recipients, net.kyori.adventure.text.Component message, boolean doPrefix)
    • sendTitle

      public static void sendTitle(org.bukkit.entity.Player recipient, String reference, Object... replacements)
    • sendTitle

      public static void sendTitle(org.bukkit.entity.Player recipient, boolean doPrefix, String reference, Object... replacements)
      Used to send a (formatted) title to the specified user
      Parameters:
      recipient - the player which the message should be sent to
      doPrefix - if the message should include the prefix or not
      reference - the reference for the message
      replacements - the value that the placeholder should be replaced with
    • sendTitle

      public static void sendTitle(org.bukkit.entity.Player recipient, @Nullable @Nullable org.bukkit.OfflinePlayer player, String reference, Object... replacement)
    • sendTitle

      public static void sendTitle(org.bukkit.entity.Player recipient, @Nullable @Nullable org.bukkit.OfflinePlayer player, boolean doPrefix, String reference, Object... replacements)
      Used to send a (formatted) title to the specified user
      Parameters:
      recipient - the player which the message should be sent to
      player - the player to format this message around
      doPrefix - if the message should include the prefix or not
      reference - the reference for the message
      replacements - the value that the placeholder should be replaced with
    • sendTitle

      public static void sendTitle(Collection<org.bukkit.entity.Player> recipients, String reference, Object... replacements)
    • sendTitle

      public static void sendTitle(Collection<org.bukkit.entity.Player> recipients, boolean doPrefix, String reference, Object... replacements)
    • sendTitle

      public static void sendTitle(Collection<org.bukkit.entity.Player> recipients, @Nullable @Nullable org.bukkit.OfflinePlayer player, String reference, Object... replacements)
    • sendTitle

      public static void sendTitle(Collection<org.bukkit.entity.Player> recipients, @Nullable @Nullable org.bukkit.OfflinePlayer player, boolean doPrefix, String reference, Object... replacements)
    • sendFullTitle

      public static void sendFullTitle(org.bukkit.entity.Player recipient, String message)
    • sendFullTitle

      public static void sendFullTitle(org.bukkit.entity.Player recipient, String message, boolean doPrefix)
    • sendFullTitle

      public static void sendFullTitle(Collection<org.bukkit.entity.Player> recipients, String message)
    • sendFullTitle

      public static void sendFullTitle(Collection<org.bukkit.entity.Player> recipients, String message, boolean doPrefix)
    • sendFullTitle

      public static void sendFullTitle(org.bukkit.entity.Player recipient, net.kyori.adventure.text.Component message)
    • sendFullTitle

      public static void sendFullTitle(org.bukkit.entity.Player recipient, net.kyori.adventure.text.Component message, boolean doPrefix)
    • sendFullTitle

      public static void sendFullTitle(Collection<org.bukkit.entity.Player> recipients, net.kyori.adventure.text.Component message)
    • sendFullTitle

      public static void sendFullTitle(Collection<org.bukkit.entity.Player> recipients, net.kyori.adventure.text.Component message, boolean doPrefix)
    • sendSubTitle

      public static void sendSubTitle(org.bukkit.entity.Player recipient, String reference, Object... replacements)
    • sendSubTitle

      public static void sendSubTitle(org.bukkit.entity.Player recipient, boolean doPrefix, String reference, Object... replacements)
      Used to send a (formatted) subtitle to the specified user
      Parameters:
      recipient - the player which the message should be sent to
      doPrefix - if the message should include the prefix or not
      reference - the reference for the message
      replacements - the value that the placeholder should be replaced with
    • sendSubTitle

      public static void sendSubTitle(org.bukkit.entity.Player recipient, @Nullable @Nullable org.bukkit.OfflinePlayer player, String reference, Object... replacements)
    • sendSubTitle

      public static void sendSubTitle(org.bukkit.entity.Player recipient, @Nullable @Nullable org.bukkit.OfflinePlayer player, boolean doPrefix, String reference, Object... replacements)
      Used to send a (formatted) subtitle to the specified user
      Parameters:
      recipient - the player which the message should be sent to
      player - the player to format this message around
      doPrefix - if the message should include the prefix or not
      reference - the reference for the message
      replacements - the value that the placeholder should be replaced with
    • sendSubTitle

      public static void sendSubTitle(Collection<org.bukkit.entity.Player> recipients, String reference, Object... replacements)
    • sendSubTitle

      public static void sendSubTitle(Collection<org.bukkit.entity.Player> recipients, boolean doPrefix, String reference, Object... replacements)
    • sendSubTitle

      public static void sendSubTitle(Collection<org.bukkit.entity.Player> recipients, @Nullable @Nullable org.bukkit.OfflinePlayer player, String reference, Object... replacements)
    • sendSubTitle

      public static void sendSubTitle(Collection<org.bukkit.entity.Player> recipients, @Nullable @Nullable org.bukkit.OfflinePlayer player, boolean doPrefix, String reference, Object... replacements)
    • sendFullSubTitle

      public static void sendFullSubTitle(org.bukkit.entity.Player recipient, String message)
    • sendFullSubTitle

      public static void sendFullSubTitle(org.bukkit.entity.Player recipient, String message, boolean doPrefix)
    • sendFullSubTitle

      public static void sendFullSubTitle(Collection<org.bukkit.entity.Player> recipients, String message)
    • sendFullSubTitle

      public static void sendFullSubTitle(Collection<org.bukkit.entity.Player> recipients, String message, boolean doPrefix)
    • sendFullSubTitle

      public static void sendFullSubTitle(org.bukkit.entity.Player recipient, net.kyori.adventure.text.Component message)
    • sendFullSubTitle

      public static void sendFullSubTitle(org.bukkit.entity.Player recipient, net.kyori.adventure.text.Component message, boolean doPrefix)
    • sendFullSubTitle

      public static void sendFullSubTitle(Collection<org.bukkit.entity.Player> recipients, net.kyori.adventure.text.Component message)
    • sendFullSubTitle

      public static void sendFullSubTitle(Collection<org.bukkit.entity.Player> recipients, net.kyori.adventure.text.Component message, boolean doPrefix)
    • sendFullTitleAndSub

      public static void sendFullTitleAndSub(org.bukkit.entity.Player recipient, String title, String subTitle)
    • sendFullTitleAndSub

      public static void sendFullTitleAndSub(org.bukkit.entity.Player recipient, String title, String subTitle, boolean doPrefix, boolean doPrefixOnSub)
    • sendFullTitleAndSub

      public static void sendFullTitleAndSub(Collection<org.bukkit.entity.Player> recipients, String title, String subTitle)
    • sendFullTitleAndSub

      public static void sendFullTitleAndSub(Collection<org.bukkit.entity.Player> recipients, String title, String subTitle, boolean doPrefix, boolean doPrefixOnSub)
    • sendFullTitleAndSub

      public static void sendFullTitleAndSub(org.bukkit.entity.Player recipient, net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component subTitle)
    • sendFullTitleAndSub

      public static void sendFullTitleAndSub(org.bukkit.entity.Player recipient, net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component subTitle, boolean doPrefix, boolean doPrefixOnSub)
    • sendFullTitleAndSub

      public static void sendFullTitleAndSub(Collection<org.bukkit.entity.Player> recipients, net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component subTitle)
    • sendFullTitleAndSub

      public static void sendFullTitleAndSub(Collection<org.bukkit.entity.Player> recipients, net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component subTitle, boolean doPrefix, boolean doPrefixOnSub)
    • getMessages

      public static HashMap<String,String> getMessages()
      Used to store all loaded messages
    • getDefaultMessagesConfigManager

      public static ConfigManager getDefaultMessagesConfigManager()
    • getPrefix

      public static String getPrefix()
      This is the prefix which goes before all messages related to this plugin
    • getPrefixComponent

      public static net.kyori.adventure.text.Component getPrefixComponent()