Class Formatter
java.lang.Object
me.tayebyassine.homestead.util.java.Formatter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringapplyPlaceholders(String string, Placeholder placeholder) Apply placeholders to a string.static StringformatPaginationMenuTitle(String title, int currentPage, int totalPages) static StringformatPrivateChat(Region region, org.bukkit.entity.Player sender, String message) Format a private region chat message.static StringgetAgo(long time) Get beautiful and readable duration "ago" string.static StringgetBalance(double amount) Get beautiful and readable balance string.static StringgetBoolean(boolean value) static StringgetDate(long date) Get beautiful and readable date timestamp string.static StringgetDuration(long millis) Get beautiful and readable duration string from milliseconds.static StringgetFlagState(boolean value) static StringgetLocation(org.bukkit.Location location) Get beautiful and readableLocationstring.static StringgetLocationChunk(org.bukkit.Chunk chunk) Get beautiful and readableChunkstring.static StringgetMembersOfRegion(Region region) Get beautiful and readable list of members of a region.static StringgetNA()static StringgetNever()static StringgetNone()static Stringstatic StringgetPlayerOwnedRegions(org.bukkit.OfflinePlayer player) Get beautiful and readable list of regions that a player owns.static StringgetPlayerPlaytime(org.bukkit.OfflinePlayer player) Get beautiful and readableOfflinePlayer's playtime string.static StringgetPlayerStatus(org.bukkit.OfflinePlayer player) Get the player status; Online, Offline, or server Banned.static StringgetPlayerTrustedRegions(org.bukkit.OfflinePlayer player) Get beautiful and readable list of region that a player is trusted in.static StringgetRating(double rate) Get beautiful and readable rate string.static StringgetRating(int rate) Get beautiful and readable rate string.static StringgetRegionsOfWar(War war) Get beautiful and readable list of regions part of a war.static StringgetRemainingTime(long time) Get beautiful and readable remaining time string.static StringgetToggle(boolean value)
-
Constructor Details
-
Formatter
public Formatter()
-
-
Method Details
-
applyPlaceholders
Apply placeholders to a string.- Parameters:
string- The stringplaceholder- The placeholders
-
getLocation
Get beautiful and readableLocationstring.- Parameters:
location- The location
-
getLocationChunk
Get beautiful and readableChunkstring.- Parameters:
chunk- The chunk
-
getBalance
Get beautiful and readable balance string.- Parameters:
amount- The amount
-
getDate
Get beautiful and readable date timestamp string.- Parameters:
date- The date timestamp
-
getRating
Get beautiful and readable rate string.- Parameters:
rate- The average rating
-
getRating
Get beautiful and readable rate string.- Parameters:
rate- The rate, from 1 to 5.
-
getRemainingTime
Get beautiful and readable remaining time string.- Parameters:
time- The remaining time
-
getDuration
Get beautiful and readable duration string from milliseconds.- Parameters:
millis- The duration in milliseconds
-
getPlayerPlaytime
Get beautiful and readableOfflinePlayer's playtime string.- Parameters:
player- The player
-
formatPaginationMenuTitle
-
formatPrivateChat
public static String formatPrivateChat(Region region, org.bukkit.entity.Player sender, String message) Format a private region chat message.PlaceholderAPI placeholders in the format are applied for the sender, before
{region},{sender}and{message}are inserted, so players can't use placeholders in what they type or in region names.- Parameters:
region- The region the message is sent tosender- The player who sent itmessage- What the player typed
-
getPlayerOwnedRegions
Get beautiful and readable list of regions that a player owns.- Parameters:
player- The player
-
getPlayerTrustedRegions
Get beautiful and readable list of region that a player is trusted in.- Parameters:
player- The player
-
getMembersOfRegion
-
getRegionsOfWar
-
getNone
-
getNA
-
getPermanent
-
getNever
-
getBoolean
-
getToggle
-
getFlagState
-
getPlayerStatus
Get the player status; Online, Offline, or server Banned. -
getAgo
Get beautiful and readable duration "ago" string.- Parameters:
time- The date timestamp
-