Class TownyMessaging

java.lang.Object
com.palmergames.bukkit.towny.TownyMessaging

public class TownyMessaging extends Object
Towny message handling class
Author:
ElgarL
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.kyori.adventure.text.Component
    getPageNavigationFooter(String prefix, int page, String arg, int total, Translator translator)
     
    static void
    sendActionBarMessageToPlayer(org.bukkit.entity.Player player, String message)
    Send an ActionBar message to the given player.
    static void
    sendActionBarMessageToPlayer(org.bukkit.entity.Player player, net.kyori.adventure.text.Component component)
    Send an ActionBar message to the given player.
    static void
    sendBossBarMessageToPlayer(org.bukkit.entity.Player player, String message, float progress, net.kyori.adventure.bossbar.BossBar.Color color, net.kyori.adventure.bossbar.BossBar.Overlay overlay)
     
    static void
    sendBossBarMessageToPlayer(org.bukkit.entity.Player player, net.kyori.adventure.bossbar.BossBar bossBar)
     
    static void
    sendBossBarMessageToPlayer(org.bukkit.entity.Player player, net.kyori.adventure.text.Component component, float progress, net.kyori.adventure.bossbar.BossBar.Color color, net.kyori.adventure.bossbar.BossBar.Overlay overlay)
     
    static void
    sendConfirmationMessage(org.bukkit.command.CommandSender sender, Confirmation confirmation)
    Sends a player click-able confirmation messages.
    static void
    Sends a message to the debug logger (and hence the console and debug.log)
    static void
    Sends a message (red) to the named Dev (if DevMode is enabled) Uses default_towny_prefix
    static void
    Sends a message (red) to the named Dev (if DevMode is enabled) Uses default_towny_prefix
    static void
    Sends a translatable error message to the console, prefixed by [Towny] Error:
    static void
    sendErrorMsg(Object sender, String msg)
    Sends an Error message (red) to the Player or console and to the named Dev if DevMode is enabled.
    static void
    Sends an error message to the log
    static void
    sendErrorMsg(org.bukkit.command.CommandSender sender, Translatable translatable)
    Sends an Error message (red) to the sender and to the named Dev if DevMode is enabled.
    static void
    sendErrorMsg(org.bukkit.command.CommandSender sender, Translatable... translatables)
    Sends an Error message (red) to the sender and to the named Dev if DevMode is enabled.
    static void
    Send a message to All online players and the log.
    static void
    Send a message to All online players and the log.
    static void
    sendInvitationMessage(org.bukkit.command.CommandSender player, String firstline, String confirmline, String cancelline)
    Sends a player click-able invitation messages.
    static void
    sendJailList(org.bukkit.command.CommandSender sender, Town town, int page, int total)
     
    static void
    sendMessage(Object sender, String line)
    Send a message.
    static void
    sendMessage(Object sender, String[] lines)
    Send a message to a player with no Towny prefix.
    static void
    sendMessage(Object sender, List<String> lines)
    Send a message to a player with no Towny prefix.
    static void
    sendMessage(org.bukkit.command.CommandSender sender, Translatable translatable)
    Sends a message translated to the end-user's locale, with no prefix.
    static void
    sendMessage(org.bukkit.command.CommandSender sender, Translatable... translatables)
    Sends a message translated to the end-user's locale, with no prefix.
    static void
    sendMsg(Resident resident, Translatable message)
    Send a translatable message to a resident if they are online, prefixed by the default_towny_prefix.
    static void
    Sends a translatable message to the console, prefixed by the default_towny_prefix.
    static void
    Sends a message to console only prefixed by [Towny]
    static void
    sendMsg(org.bukkit.command.CommandSender sender, Translatable translatable)
    Sends a message in green, prefixed by the default_towny_prefix to the sender, translated to the end-user's locale.
    static void
    sendMsg(org.bukkit.command.CommandSender sender, Translatable... translatables)
    Sends a message in green, prefixed by the default_towny_prefix to the sender, translated to the end-user's locale.
    static void
    sendMsg(org.bukkit.command.CommandSender sender, String msg)
    Towny's main endpoint for Towny-Prefixed messages.
    static void
    Send a message to All online ops or players with towny.admin, and the log.
    static void
    sendNationBoard(org.bukkit.command.CommandSender sender, Nation nation)
    Send the nation board to a player (in yellow)
    static void
    sendNationList(org.bukkit.command.CommandSender sender, List<Pair<UUID,net.kyori.adventure.text.Component>> nations, ComparatorType compType, int page, int total)
     
    static void
    Send a message to All online residents of a nation and log, preceded by the default_towny_prefix
    static void
    sendOutpostList(org.bukkit.entity.Player player, Town town, int page, int total)
     
    static void
    Send a message to All online players and the log.
    static void
    sendPlotGroupList(org.bukkit.command.CommandSender sender, Town town, int page, int total)
     
    static void
    sendPlotList(org.bukkit.command.CommandSender sender, Resident resident, int page, int totalPages)
     
    static void
    Send a message to All online residents of a nation and log preceded by the [NationName], translated for the end-user.
    static void
    Send a message to All online residents of a nation and log with the [nationname] prefixed to the beginning
    static void
    Sends a message to all online residents of the specified resident's town, if they have one.
    static void
    Send a message to All online residents of a town and log preceded by the [Townname], translated for the end-user.
    static void
    Send a message to All online residents of a town and log preceded by the [Townname]
    static void
    sendRequestMessage(org.bukkit.command.CommandSender player, Invite invite)
     
    static void
    sendStatusScreen(org.bukkit.command.CommandSender sender, StatusScreen screen)
     
    static void
    sendTitle(org.bukkit.entity.Player player, String title, String subtitle)
    Send the player a Title message with default duration (70 ticks.)
    static void
    sendTitle(org.bukkit.entity.Player player, String title, String subtitle, int duration)
    Send the player a Title message for a specified number of ticks.
    static void
    sendTitleMessageToNation(Nation nation, String title, String subtitle)
    Send a Title and Subtitle to a nation with default duration (70 ticks.)
    static void
    sendTitleMessageToNation(Nation nation, String title, String subtitle, int duration)
    Send a Title and Subtitle to a nation for a specified number of ticks.
    static void
    sendTitleMessageToResident(Resident resident, String title, String subtitle)
    Send a Title and Subtitle to a resident with default duration (70 ticks.)
    static void
    sendTitleMessageToResident(Resident resident, String title, String subtitle, int duration)
    Send a Title and Subtitle to a resident for a specified number of ticks.
    static void
    sendTitleMessageToTown(Town town, String title, String subtitle)
    Send a Title and Subtitle to a town with default duration (70 ticks.)
    static void
    sendTitleMessageToTown(Town town, String title, String subtitle, int duration)
    Send a Title and Subtitle to a town for a specified number of ticks.
    static void
    sendTownBoard(org.bukkit.command.CommandSender sender, Town town)
    Send the town board to a player (in yellow)
    static void
    sendTownList(org.bukkit.command.CommandSender sender, List<Pair<UUID,net.kyori.adventure.text.Component>> towns, ComparatorType compType, int page, int total)
     
    static void
    Send a message to All online residents of a town and log, preceded by the default_towny_prefix

    Methods inherited from class java.lang.Object

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

    • TownyMessaging

      public TownyMessaging()
  • Method Details

    • sendErrorMsg

      public static void sendErrorMsg(String msg)
      Sends an error message to the log
      Parameters:
      msg - message to send
    • sendErrorMsg

      public static void sendErrorMsg(Object sender, String msg)
      Sends an Error message (red) to the Player or console and to the named Dev if DevMode is enabled. Uses default_towny_prefix. If msg is empty nothing will be sent.
      Parameters:
      sender - the Object sending the message
      msg - the message to send
    • sendMsg

      public static void sendMsg(String msg)
      Sends a message to console only prefixed by [Towny]
      Parameters:
      msg - the message to be sent
    • sendMsg

      public static void sendMsg(org.bukkit.command.CommandSender sender, String msg)
      Towny's main endpoint for Towny-Prefixed messages. Sends a message (green) to the Player or console and to the named Dev if DevMode is enabled. Uses default_towny_prefix
      Parameters:
      sender - the CommandSender receiving the msg
      msg - the message being sent
    • sendDevMsg

      public static void sendDevMsg(String msg)
      Sends a message (red) to the named Dev (if DevMode is enabled) Uses default_towny_prefix
      Parameters:
      msg - the message to be sent
    • sendDevMsg

      public static void sendDevMsg(String[] msg)
      Sends a message (red) to the named Dev (if DevMode is enabled) Uses default_towny_prefix
      Parameters:
      msg - the message to be sent
    • sendDebugMsg

      public static void sendDebugMsg(String msg)
      Sends a message to the debug logger (and hence the console and debug.log)
      Parameters:
      msg - the message to be sent
    • sendMessage

      public static void sendMessage(Object sender, String line)
      Send a message. This is the main end point for all String based messages before being sent to the eventual reader.
      Parameters:
      sender - the Object sending the message
      line - the String to send
    • sendMessage

      public static void sendMessage(Object sender, List<String> lines)
      Send a message to a player with no Towny prefix.
      Parameters:
      sender - the Object sending the message
      lines - List of strings to send
    • sendMessage

      public static void sendMessage(Object sender, String[] lines)
      Send a message to a player with no Towny prefix.
      Parameters:
      sender - the Object sending the message
      lines - String array to send as message.
    • sendGlobalMessage

      public static void sendGlobalMessage(String line)
      Send a message to All online players and the log. Uses default_towny_prefix
      Parameters:
      line - the message to send
    • sendPlainGlobalMessage

      public static void sendPlainGlobalMessage(String line)
      Send a message to All online players and the log. Does not use the default_towny_prefix.
      Parameters:
      line - the message to send.
    • sendPrefixedTownMessage

      public static void sendPrefixedTownMessage(Town town, String line)
      Send a message to All online residents of a town and log preceded by the [Townname]
      Parameters:
      town - the town to pass the message to, and prefix message with
      line - the actual message
    • sendPrefixedNationMessage

      public static void sendPrefixedNationMessage(Nation nation, String line)
      Send a message to All online residents of a nation and log with the [nationname] prefixed to the beginning
      Parameters:
      nation - nation to send to, and prefix message with
      line - the message
    • sendTownBoard

      public static void sendTownBoard(org.bukkit.command.CommandSender sender, Town town)
      Send the town board to a player (in yellow)
      Parameters:
      sender - sender to show to
      town - the town for which to show it's board
    • sendNationBoard

      public static void sendNationBoard(org.bukkit.command.CommandSender sender, Nation nation)
      Send the nation board to a player (in yellow)
      Parameters:
      sender - Sender to show to
      nation - the nation for which to show it's board
    • sendTitleMessageToResident

      public static void sendTitleMessageToResident(Resident resident, String title, String subtitle, int duration)
      Send a Title and Subtitle to a resident for a specified number of ticks.
      Parameters:
      resident - Resident to receive title & subtitle message.
      title - Title message to send.
      subtitle - Subtitle message to send.
      duration - Number of ticks to display the message.
    • sendTitleMessageToResident

      public static void sendTitleMessageToResident(Resident resident, String title, String subtitle)
      Send a Title and Subtitle to a resident with default duration (70 ticks.)
      Parameters:
      resident - Resident to receive title & subtitle message.
      title - Title message to send.
      subtitle - Subtitle message to send.
    • sendTitleMessageToTown

      public static void sendTitleMessageToTown(Town town, String title, String subtitle, int duration)
      Send a Title and Subtitle to a town for a specified number of ticks.
      Parameters:
      town - Town to receive title & subtitle messages.
      title - Title message to send.
      subtitle - Subtitle message to send.
      duration - Number of ticks to display the message.
    • sendTitleMessageToTown

      public static void sendTitleMessageToTown(Town town, String title, String subtitle)
      Send a Title and Subtitle to a town with default duration (70 ticks.)
      Parameters:
      town - Town to receive title & subtitle messages.
      title - Title message to send.
      subtitle - Subtitle message to send.
    • sendTitleMessageToNation

      public static void sendTitleMessageToNation(Nation nation, String title, String subtitle, int duration)
      Send a Title and Subtitle to a nation for a specified number of ticks.
      Parameters:
      nation - Nation to receive title & subtitle messages.
      title - Title message to send.
      subtitle - Subtitle message to send.
      duration - Number of ticks to display the message.
    • sendTitleMessageToNation

      public static void sendTitleMessageToNation(Nation nation, String title, String subtitle)
      Send a Title and Subtitle to a nation with default duration (70 ticks.)
      Parameters:
      nation - Nation to receive title & subtitle messages.
      title - Title message to send.
      subtitle - Subtitle message to send.
    • sendTitle

      public static void sendTitle(org.bukkit.entity.Player player, String title, String subtitle, int duration)
      Send the player a Title message for a specified number of ticks.

      As of MC 1.18 a null title will mean the message is never sent, so we are changing empty Strings to " ".

      Parameters:
      player - Player being send the Title message.
      title - String title message.
      subtitle - String subtitle message.
      duration - How long the title is shown for in ticks.
    • sendTitle

      public static void sendTitle(org.bukkit.entity.Player player, String title, String subtitle)
      Send the player a Title message with default duration (70 ticks.)
      Parameters:
      player - Player being send the Title message.
      title - String title message.
      subtitle - String subtitle message.
    • sendRequestMessage

      public static void sendRequestMessage(org.bukkit.command.CommandSender player, Invite invite)
    • sendInvitationMessage

      public static void sendInvitationMessage(org.bukkit.command.CommandSender player, String firstline, String confirmline, String cancelline)
      Sends a player click-able invitation messages.
      Parameters:
      player - - The player (CommandSender) to send the confirmation
      firstline - - The question regarding the confirmation.
      confirmline - - Line for sending the confirmation.
      cancelline - - Line for sending the cancellation.
    • sendConfirmationMessage

      public static void sendConfirmationMessage(org.bukkit.command.CommandSender sender, Confirmation confirmation)
      Sends a player click-able confirmation messages.
      Parameters:
      sender - - The player (CommandSender) to send the confirmation
      confirmation - - Confirmation to send to the player.
    • sendTownList

      public static void sendTownList(org.bukkit.command.CommandSender sender, List<Pair<UUID,net.kyori.adventure.text.Component>> towns, ComparatorType compType, int page, int total)
    • getPageNavigationFooter

      public static net.kyori.adventure.text.Component getPageNavigationFooter(String prefix, int page, String arg, int total, Translator translator)
    • sendNationList

      public static void sendNationList(org.bukkit.command.CommandSender sender, List<Pair<UUID,net.kyori.adventure.text.Component>> nations, ComparatorType compType, int page, int total)
    • sendOutpostList

      public static void sendOutpostList(org.bukkit.entity.Player player, Town town, int page, int total)
    • sendJailList

      public static void sendJailList(org.bukkit.command.CommandSender sender, Town town, int page, int total)
    • sendPlotGroupList

      public static void sendPlotGroupList(org.bukkit.command.CommandSender sender, Town town, int page, int total)
    • sendPlotList

      public static void sendPlotList(org.bukkit.command.CommandSender sender, Resident resident, int page, int totalPages)
    • sendMsg

      public static void sendMsg(org.bukkit.command.CommandSender sender, Translatable... translatables)
      Sends a message in green, prefixed by the default_towny_prefix to the sender, translated to the end-user's locale.
      Parameters:
      sender - CommandSender who will see the message.
      translatables - Translatable object(s) which will be translated, joined with a space.
      See Also:
    • sendMsg

      public static void sendMsg(org.bukkit.command.CommandSender sender, Translatable translatable)
      Sends a message in green, prefixed by the default_towny_prefix to the sender, translated to the end-user's locale.
      Parameters:
      sender - CommandSender who will see the message.
      translatable - Translatable object which will be translated.
    • sendMessage

      public static void sendMessage(org.bukkit.command.CommandSender sender, Translatable... translatables)
      Sends a message translated to the end-user's locale, with no prefix.
      Parameters:
      sender - CommandSender who will see the message.
      translatables - Translatable... object(s) which will be translated.
      See Also:
    • sendMessage

      public static void sendMessage(org.bukkit.command.CommandSender sender, Translatable translatable)
      Sends a message translated to the end-user's locale, with no prefix.
      Parameters:
      sender - CommandSender who will see the message.
      translatable - Translatable object which will be translated.
    • sendErrorMsg

      public static void sendErrorMsg(org.bukkit.command.CommandSender sender, Translatable... translatables)
      Sends an Error message (red) to the sender and to the named Dev if DevMode is enabled. Uses default_towny_prefix. Translates to the end-user's locale.
      Parameters:
      sender - CommandSender who will receive the error message.
      translatables - Translatable... object(s) to be translated using the locale of the end-user.
      See Also:
    • sendErrorMsg

      public static void sendErrorMsg(org.bukkit.command.CommandSender sender, Translatable translatable)
      Sends an Error message (red) to the sender and to the named Dev if DevMode is enabled. Uses default_towny_prefix. Translates to the end-user's locale.
      Parameters:
      sender - CommandSender who will receive the error message.
      translatable - Translatable object to be translated using the locale of the end-user.
    • sendGlobalMessage

      public static void sendGlobalMessage(Translatable translatable)
      Send a message to All online players and the log. Uses default_towny_prefix. Message is translated for the end-user.
      Parameters:
      translatable - Translatable object to be messaged to the player using their locale.
    • sendPrefixedNationMessage

      public static void sendPrefixedNationMessage(Nation nation, Translatable message)
      Send a message to All online residents of a nation and log preceded by the [NationName], translated for the end-user.
      Parameters:
      nation - Nation to pass the message to, prefix message with.
      message - Translatable object to be messaged to the player using their locale.
    • sendPrefixedTownMessage

      public static void sendPrefixedTownMessage(Town town, Translatable message)
      Send a message to All online residents of a town and log preceded by the [Townname], translated for the end-user.
      Parameters:
      town - Town to pass the message to, and prefix message with.
      message - Translatable object to be messaged to the player using their locale.
    • sendPrefixedTownMessage

      public static void sendPrefixedTownMessage(Resident resident, Translatable message)
      Sends a message to all online residents of the specified resident's town, if they have one. If the resident does not have a town, the message will be sent to the resident instead.
      Parameters:
      resident - The resident.
      message - The translatable message to be sent to the resident and/or their town.
    • sendNationMessagePrefixed

      public static void sendNationMessagePrefixed(Nation nation, Translatable message)
      Send a message to All online residents of a nation and log, preceded by the default_towny_prefix
      Parameters:
      nation - Nation which will receive the message.
      message - Translatable message to be shown to the town.
    • sendTownMessagePrefixed

      public static void sendTownMessagePrefixed(Town town, Translatable message)
      Send a message to All online residents of a town and log, preceded by the default_towny_prefix
      Parameters:
      town - Town which will receive the message.
      message - Translatable message to be shown to the town.
    • sendMsg

      public static void sendMsg(Resident resident, Translatable message)
      Send a translatable message to a resident if they are online, prefixed by the default_towny_prefix.
      Parameters:
      resident - Resident to receive the message.
      message - Translatable message for the resident.
    • sendMsg

      public static void sendMsg(Translatable message)
      Sends a translatable message to the console, prefixed by the default_towny_prefix.
      Parameters:
      message - Translatable message to show the console.
    • sendErrorMsg

      public static void sendErrorMsg(Translatable message)
      Sends a translatable error message to the console, prefixed by [Towny] Error:
      Parameters:
      message - Translatable error message to show the console.
    • sendMsgToOnlineAdmins

      public static void sendMsgToOnlineAdmins(Translatable message)
      Send a message to All online ops or players with towny.admin, and the log.
      Parameters:
      message - Translatable message to send.
    • sendStatusScreen

      public static void sendStatusScreen(org.bukkit.command.CommandSender sender, StatusScreen screen)
    • sendActionBarMessageToPlayer

      public static void sendActionBarMessageToPlayer(org.bukkit.entity.Player player, String message)
      Send an ActionBar message to the given player.
      Parameters:
      player - Player who will be shown the message.
      message - String message which will be made into a TextComponent and shown in the ActioBar.
    • sendActionBarMessageToPlayer

      public static void sendActionBarMessageToPlayer(org.bukkit.entity.Player player, net.kyori.adventure.text.Component component)
      Send an ActionBar message to the given player.
      Parameters:
      player - Player who will be shown the message.
      component - Component message which will be shown to the player.
    • sendBossBarMessageToPlayer

      public static void sendBossBarMessageToPlayer(org.bukkit.entity.Player player, String message, float progress, net.kyori.adventure.bossbar.BossBar.Color color, net.kyori.adventure.bossbar.BossBar.Overlay overlay)
    • sendBossBarMessageToPlayer

      public static void sendBossBarMessageToPlayer(org.bukkit.entity.Player player, net.kyori.adventure.text.Component component, float progress, net.kyori.adventure.bossbar.BossBar.Color color, net.kyori.adventure.bossbar.BossBar.Overlay overlay)
    • sendBossBarMessageToPlayer

      public static void sendBossBarMessageToPlayer(org.bukkit.entity.Player player, net.kyori.adventure.bossbar.BossBar bossBar)