Package com.palmergames.bukkit.towny
Class TownyFormatter
java.lang.Object
com.palmergames.bukkit.towny.TownyFormatter
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final SimpleDateFormat
static final String
static final String
static final String
static final SimpleDateFormat
static final SimpleDateFormat
static final String
1 = Description 2 = Count Colours: 3 = Description and : 4 = Count 5 = Colour for the start of the liststatic final SimpleDateFormat
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
colourBracketElement
(String key, String value) static String
colourHoverKey
(String key) static String
static String
colourKeyImportant
(String key) static String
colourKeyValue
(String key, String value) static String
formatPopulationBrackets
(int size) static List
<net.kyori.adventure.text.Component> Returns a list of MetaData used in the StatusScreens.static String[]
getFormattedNames
(TownyObject[] objs) Returns an Array of names, using their Formatted (long) names, with ColourCodes translated.getFormattedNames
(Collection<? extends Nameable> objects) static String
getFormattedOnlineResidents
(String prefix, ResidentList residentList, org.bukkit.entity.Player player) Used in /n online and /t online.static String
getFormattedStrings
(String prefix, List<String> list) Used to prefix, count and list the given strings.static String
getFormattedStrings
(String prefix, List<String> list, int size) Used to prefix, count and list the given strings.Returns a list of names, with ColourCodes translated.static String
getFormattedTownyObjects
(String prefix, List<TownyObject> objectlist) Used to prefix, count and list the given object.getNationSubtitle
(Nation nation, Translator translator) Returns the 2nd line of the Nation StatusScreen.getRanksForNation
(Nation nation, Translator translator) Returns a Chat Formatted List of all nation residents who hold a rank.getRanksForTown
(Town town, Translator translator) Returns a Chat Formatted List of all town residents who hold a rank.static StatusScreen
Gets the status screen of a Nation.static StatusScreen
Gets the status screen of a Residentstatic StatusScreen
Gets the status screen of a TownBlockstatic StatusScreen
Gets the status screen of a Town.static StatusScreen
getStatus
(TownyWorld world, org.bukkit.command.CommandSender sender) Gets the status screen for a World.getTaxStatus
(Resident resident, Translator translator) Returns the tax info this resident will have to pay at the next new day.static String
getTime()
getTownSubtitle
(Town town, TownyWorld world, Translator translator) Returns the 2nd line of the Town StatusScreen.static void
static void
shortenOverLengthList
(List<String> list, int i, Translator translator)
-
Field Details
-
lastOnlineFormat
-
lastOnlineFormatIncludeYear
-
registeredFormat
-
fullDateFormat
-
listPrefixFormat
1 = Description 2 = Count Colours: 3 = Description and : 4 = Count 5 = Colour for the start of the list- See Also:
-
keyValueFormat
- See Also:
-
keyFormat
- See Also:
-
hoverFormat
- See Also:
-
bracketFormat
- See Also:
-
-
Constructor Details
-
TownyFormatter
public TownyFormatter()
-
-
Method Details
-
initialize
public static void initialize() -
getStatus
Gets the status screen of a TownBlock- Parameters:
townBlock
- the TownBlock to checkplayer
- Player who will be sent this status.- Returns:
- StatusScreen containing the results.
-
getStatus
Gets the status screen of a Resident- Parameters:
resident
- the resident to check the status ofsender
- The sender who executed the command.- Returns:
- StatusScreen containing the results.
-
getStatus
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
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
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
-
colourKey
-
colourKeyImportant
-
colourBracketElement
-
colourHoverKey
-
formatPopulationBrackets
-
shortenOverLengthList
-
getTownSubtitle
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
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
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
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
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
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
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
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
-
getTaxStatus
Returns the tax info this resident will have to pay at the next new day.- Parameters:
resident
- the resident to checktranslator
- Translator to localize messaging.- Returns:
- tax status message
-
getRanksForTown
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
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
- Returns:
- the Time.
-