Class TownyFormatter

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

public class TownyFormatter extends Object
  • Field Details

  • Constructor Details

    • TownyFormatter

      public TownyFormatter()
  • Method Details

    • initialize

      public static void initialize()
    • getStatus

      public static StatusScreen getStatus(TownBlock townBlock, org.bukkit.entity.Player player)
      Gets the status screen of a TownBlock
      Parameters:
      townBlock - the TownBlock to check
      player - Player who will be sent this status.
      Returns:
      StatusScreen containing the results.
    • getStatus

      public static StatusScreen getStatus(Resident resident, org.bukkit.command.CommandSender sender)
      Gets the status screen of a Resident
      Parameters:
      resident - the resident to check the status of
      sender - The sender who executed the command.
      Returns:
      StatusScreen containing the results.
    • getStatus

      public static StatusScreen getStatus(Town town, org.bukkit.command.CommandSender sender)
      Gets the status screen of a Town.
      Parameters:
      town - the town in which to check.
      sender - CommandSender who will be sent the status.
      Returns:
      StatusScreen containing the results.
    • getStatus

      public static StatusScreen getStatus(Nation nation, org.bukkit.command.CommandSender sender)
      Gets the status screen of a Nation.
      Parameters:
      nation - the nation to check against.
      sender - CommandSender who will be sent the status.
      Returns:
      StatusScreen containing the results.
    • getStatus

      public static StatusScreen getStatus(TownyWorld world, org.bukkit.command.CommandSender sender)
      Gets the status screen for a World.
      Parameters:
      world - the world to check.
      sender - CommandSender who will be sent the status.
      Returns:
      StatusScreen containing the results.
    • colourKeyValue

      public static String colourKeyValue(String key, String value)
    • colourKey

      public static String colourKey(String key)
    • colourKeyImportant

      public static String colourKeyImportant(String key)
    • colourBracketElement

      public static String colourBracketElement(String key, String value)
    • colourHoverKey

      public static String colourHoverKey(String key)
    • formatPopulationBrackets

      public static String formatPopulationBrackets(int size)
    • shortenOverLengthList

      public static void shortenOverLengthList(List<String> list, int i, Translator translator)
    • getTownSubtitle

      public static List<String> getTownSubtitle(Town town, TownyWorld world, Translator translator)
      Returns the 2nd line of the Town StatusScreen.
      Parameters:
      town - Town for which to get the StatusScreen.
      world - TownyWorld in which the town considers home.
      translator - Translator used in language selection.
      Returns:
      Formatted 2nd line of the Town StatusScreen.
    • getNationSubtitle

      public static List<String> getNationSubtitle(Nation nation, Translator translator)
      Returns the 2nd line of the Nation StatusScreen.
      Parameters:
      nation - Nation for which to get the StatusScreen.
      translator - Translator used in language selection.
      Returns:
      Formatted 2nd line of the Nation StatusScreen.
    • getExtraFields

      public static List<net.kyori.adventure.text.Component> getExtraFields(TownyObject to)
      Returns a list of MetaData used in the StatusScreens.
      Parameters:
      to - TownyObject for which to gather the metadata of.
      Returns:
      List of visible metadata.
    • getFormattedOnlineResidents

      public static String getFormattedOnlineResidents(String prefix, ResidentList residentList, org.bukkit.entity.Player player)
      Used in /n online and /t online.
      Parameters:
      prefix - String prefix to use.
      residentList - ResidentList representing the town or nation.
      player - Player which is doing the looking, used for Vanishing.
      Returns:
      String of formatted residents listed and prefixed.
    • getFormattedTownyObjects

      public static String getFormattedTownyObjects(String prefix, List<TownyObject> objectlist)
      Used to prefix, count and list the given object.
      Parameters:
      prefix - String applied to beginning of the list.
      objectlist - List of TownyObjects to list.
      Returns:
      Formatted, prefixed list of TownyObjects.
    • getFormattedStrings

      public static String getFormattedStrings(String prefix, List<String> list)
      Used to prefix, count and list the given strings.
      Parameters:
      prefix - String applied to beginning of the list.
      list - List of Strings to list.
      Returns:
      Formatted, prefixed list of Strings.
    • getFormattedStrings

      public static String getFormattedStrings(String prefix, List<String> list, int size)
      Used to prefix, count and list the given strings.
      Parameters:
      prefix - String applied to beginning of the list.
      list - List of Strings to list.
      Returns:
      Formatted, prefixed list of Strings.
    • getFormattedTownyNames

      public static List<String> getFormattedTownyNames(List<TownyObject> objs)
      Returns a list of names, with ColourCodes translated. If the list is under 20 long, it will use the formatted names.
      Parameters:
      objs - List of TownyObjects of which to make a list of names.
      Returns:
      List of Names coloured, and potentially formatted.
    • getFormattedNames

      public static String[] getFormattedNames(TownyObject[] objs)
      Returns an Array of names, using their Formatted (long) names, with ColourCodes translated.
      Parameters:
      objs - Array of TownyObjects of which to make a list of names.
      Returns:
      Array of Names, formatted and coloured.
    • getFormattedNames

      public static List<String> getFormattedNames(Collection<? extends Nameable> objects)
    • getTaxStatus

      public static List<String> getTaxStatus(Resident resident, Translator translator)
      Returns the tax info this resident will have to pay at the next new day.
      Parameters:
      resident - the resident to check
      translator - Translator to localize messaging.
      Returns:
      tax status message
    • getRanksForTown

      public static List<String> getRanksForTown(Town town, Translator translator)
      Returns a Chat Formatted List of all town residents who hold a rank.
      Parameters:
      town - the town for which to check against.
      translator - localization to use.
      Returns:
      a list containing formatted rank data.
    • getRanksForNation

      public static List<String> getRanksForNation(Nation nation, Translator translator)
      Returns a Chat Formatted List of all nation residents who hold a rank.
      Parameters:
      nation - the nation for which to check against.
      translator - localization to use.
      Returns:
      a list containing formatted rank data.
    • getTime

      public static String getTime()
      Returns:
      the Time.