public class FrostAPI extends Object
| Constructor and Description |
|---|
FrostAPI() |
| Modifier and Type | Method and Description |
|---|---|
void |
addToList(List<Boolean> list,
Boolean value,
boolean condition)
A method used to add a boolean to a list if a condition is met
|
void |
addToList(List<Integer> list,
Integer value,
boolean condition)
A method used to add an integer to a list if a condition is met
|
void |
addToList(List<Object> list,
Object value,
boolean condition)
A method used to add an object to a list if a condition is met
|
void |
addToList(List<String> list,
String value,
boolean condition)
A method used to add a string to a list if a condition is met
|
static boolean |
allFalse(boolean... conditions)
A method used to test the conditions and will return true if all conditions are false.
|
static boolean |
allTrue(boolean... conditions)
A method used to test the conditions and will return true if all conditions are true.
|
static boolean |
anyFalse(boolean... conditions)
A method used to test the conditions and will return true if any of the conditions are false.
|
static boolean |
anyTrue(boolean... conditions)
A method used to test the conditions and will return true if any of the conditions are true.
|
void |
createParent(@NotNull File target)
A method used to create all parent directories for a targeted file.
|
@NotNull String |
format(boolean stripColor,
String input,
Object... param)
A method used to format a string and translate Bukkit color codes
|
String |
format(ConsoleColor color,
String input,
Object... param)
A method used to format our console colors into the specified input, this method includes
the ability to add parameters by default.
|
String |
format(Date date)
A method used to format a date to a pre-defined pattern
|
String |
format(String pattern,
Date date)
A method used to format a date to a specific pattern
|
@NotNull String |
format(String input,
Object... param)
A method used to format a method to include an array of parameters in the message
using a number format variable (i.e {0}).
|
String |
getCreatedDate(@NotNull File target)
This method is used to get the date a file was created.
|
String |
getExtension(File target)
A method used to get the file extension from a file path
|
String |
getExtension(@NotNull File target,
boolean dotless)
A method used to get the file extension from a file path, Additionally define whether
the extension should contain its '.' character.
|
String |
getExtension(Path path)
A method used to get the file extension from a file path
|
String |
getExtension(@NotNull Path path,
boolean dotless)
A method used to get the file extension from a file path, Additionally define whether
the extension should contain its '.' character.
|
String |
getExtension(String path)
A method used to get the file extension from a string representation of a file path
|
String |
getExtension(String path,
boolean dotless)
A method used to get the file extension from a string representation of a file path.
|
BasicFileAttributes |
getFileAttribute(@NotNull File target)
A method used to get the attributes to a file.
|
String |
getFileName(@NotNull Path path)
A method used to get the file name in a path.
|
String |
getFileName(String path)
A method used to get the file name in a path.
|
static @NotNull FrostAPI |
getInstance()
A method used to return an instance of this api class
|
String |
getLastAccessed(@NotNull File target)
This method is used to get the date a file was last accessed.
|
String |
getLastModified(@NotNull File target)
This method is used to get the date a file was last modified.
|
InputStream |
getResource(String name)
Returns an input stream for reading the specified resource.
|
URL |
getResourceURL(String name)
A method used to return the url for a resource located in this .jar's resources file.
|
Date |
getToday()
A method used to return the current time
|
String |
getTodayAsString()
A method used to return the current date and time as a string
|
String |
getTodayAsString(String pattern)
A method used to return the current date and time as a string
|
boolean |
isAfterDate(@NotNull Date target,
Date comparedTo)
A method used to test whether a date is after a different date.
|
boolean |
isAfterDate(String target,
String comparedTo)
A method used to test whether a date is after a different date.
|
boolean |
isBeforeDate(@NotNull Date target,
Date comparedTo)
A method used to test whether a date is before a different date.
|
boolean |
isBeforeDate(Date target,
String comparedTo)
A method used to test whether a date is before a different date.
|
boolean |
isBeforeDate(String target,
Date comparedTo)
A method used to test whether a date is before a different date.
|
boolean |
isBeforeDate(String target,
String comparedTo)
A method used to test whether a date is before a different date.
|
boolean |
isDirectory(@NotNull File target)
A method used to return whether an index is a directory or not.
|
boolean |
isDirectory(@NotNull Path path)
A method used to return whether an index path is a directory or not.
|
boolean |
isDirectory(String path)
A method used to return whether an index path is a directory or not.
|
boolean |
isFile(@NotNull File target)
A method used to return whether an index is a file or not.
|
boolean |
isFile(@NotNull Path path)
A method used to return whether an index path is a file or not.
|
boolean |
isFile(String path)
A method used to return whether an index path is a file or not.
|
void |
relocateIndex(File target,
File location)
A method used to relocate an index to a new location
|
void |
renameIndex(File target,
String name)
A method used to rename an index
|
void |
renameParent(@NotNull File target,
String name)
A method used to rename the parent directory of an index.
|
void |
saveResource(File location,
String name)
A method used to save a resource from our resource file to a defined location.
|
void |
saveResource(File location,
String name,
boolean replace)
A method used to save a resource from our resource file to a defined location.
|
@NotNull List<String> |
stripColor(@NotNull List<String> list)
A method used to remove color codes from any given string list this method
will iterate through the list and individually remove color codes.
|
String |
stripColor(String input)
A method used to strip color codes from an input, it will remove any color codes present.
|
boolean |
toBoolean(Object target)
A method used to return an object as a boolean
|
Date |
toDate(String input)
A method used to convert a string to a valid date.
|
int |
toDay(Object amount)
A method used in a runnable.
|
double |
toDouble(Object target)
A method used to return an object as a double
|
File |
toFile(File parent,
@NotNull String path)
A method used to create a file object from a string path.
|
File |
toFile(Path path)
A method used to create a file object from a path.
|
File |
toFile(String path)
A method used to create a file object from a string path.
|
int |
toHour(Object amount)
A method used in a runnable.
|
int |
toInteger(Object target)
A method used to return an object as an integer
|
Locale |
toLocale(@NotNull String target)
A method used to convert a string into a usable locale, this method pairs with the
Apache Commons library to convert the string.
|
int |
toMinute(Object amount)
A method used in a runnable.
|
int |
toSecond(Object amount)
A method used in a runnable.
|
String |
toString(Object target)
A method used to return an object as a string
|
int |
toTime(@NotNull String input)
A method used to turn a string into a valid time, and calculate the amount required.
|
@Contract(value=" -> new",
pure=true)
@NotNull
public static @NotNull FrostAPI getInstance()
public InputStream getResource(String name)
name - The resource namenull if the
resource could not be found, the resource is in a package that
is not opened unconditionally, or access to the resource is
denied by the security manager.NullPointerException - If name is nullpublic URL getResourceURL(String name)
name - Target resource file nameNullPointerException - If name is nullpublic void saveResource(File location, String name)
location - Target locationname - Resource namepublic void saveResource(File location, String name, boolean replace)
location - Target locationname - Resource namereplace - Whether an existing resource should be replaced.public void createParent(@NotNull
@NotNull File target)
target - The file pathpublic File toFile(String path)
path - Target pathpublic File toFile(Path path)
path - Target pathpublic File toFile(File parent, @NotNull @NotNull String path)
parent - The starting point to the path.path - Target pathpublic String toString(Object target)
target - Target objectpublic boolean toBoolean(Object target)
target - Target objectpublic int toInteger(Object target)
target - Target objectpublic double toDouble(Object target)
target - Target objectpublic Locale toLocale(@NotNull @NotNull String target)
target - Targeted inputpublic String getExtension(String path)
path - String representation of file pathpublic String getExtension(File target)
target - File pathpublic String getExtension(Path path)
path - File pathpublic String getExtension(String path, boolean dotless)
path - String representation of file pathdotless - Whether our return value should contain a '.' characterpublic String getExtension(@NotNull @NotNull File target, boolean dotless)
target - File pathdotless - Whether our return value should contain a '.' characterpublic String getExtension(@NotNull @NotNull Path path, boolean dotless)
path - File pathdotless - Whether our return value should contain a '.' characterpublic String getFileName(String path)
path - Target pathpublic String getFileName(@NotNull @NotNull Path path)
path - Target pathpublic BasicFileAttributes getFileAttribute(@NotNull @NotNull File target)
target - Target filepublic String getCreatedDate(@NotNull @NotNull File target)
target - The target filepublic String getLastModified(@NotNull @NotNull File target)
target - The target filepublic String getLastAccessed(@NotNull @NotNull File target)
target - The target filepublic boolean isFile(@NotNull
@NotNull File target)
target - Targeted indexpublic boolean isFile(String path)
path - Targeted indexpublic boolean isFile(@NotNull
@NotNull Path path)
path - Targeted indexpublic boolean isDirectory(@NotNull
@NotNull File target)
target - Targeted indexpublic boolean isDirectory(String path)
path - Targeted indexpublic boolean isDirectory(@NotNull
@NotNull Path path)
path - Targeted indexpublic void renameParent(@NotNull
@NotNull File target,
String name)
target - Target filename - New parent namepublic void renameIndex(File target, String name)
target - Target filename - New namepublic void relocateIndex(File target, File location)
target - Target indexlocation - Desired Locationpublic Date getToday()
public String getTodayAsString()
public String getTodayAsString(String pattern)
pattern - Date patternpublic int toSecond(Object amount)
amount - Amount of seconds.public int toMinute(Object amount)
amount - Amount of minutes.public int toHour(Object amount)
amount - Amount of hours.public int toDay(Object amount)
amount - Amount of days.public int toTime(@NotNull
@NotNull String input)
input - String inputpublic Date toDate(String input)
input - String representation of a date.public boolean isBeforeDate(String target, String comparedTo)
target - The date being tested.comparedTo - The date you will compare the target to.public boolean isBeforeDate(String target, Date comparedTo)
target - The date being tested.comparedTo - The date you will compare the target to.public boolean isBeforeDate(Date target, String comparedTo)
target - The date being tested.comparedTo - The date you will compare the target to.public boolean isBeforeDate(@NotNull
@NotNull Date target,
Date comparedTo)
target - The date being tested.comparedTo - The date you will compare the target to.public boolean isAfterDate(String target, String comparedTo)
target - The date being tested.comparedTo - The date you will compare the target to.public boolean isAfterDate(@NotNull
@NotNull Date target,
Date comparedTo)
target - The date being tested.comparedTo - The date you will compare the target to.public static boolean allTrue(boolean... conditions)
conditions - Tested conditionspublic static boolean allFalse(boolean... conditions)
conditions - Tested conditionspublic static boolean anyTrue(boolean... conditions)
conditions - Tested conditionspublic static boolean anyFalse(boolean... conditions)
conditions - Tested conditionspublic String format(Date date)
date - Target datepublic String format(String pattern, Date date)
pattern - Desired patterndate - Target date@NotNull public @NotNull String format(String input, Object... param)
input - Target messageparam - Optional params@NotNull public @NotNull String format(boolean stripColor, String input, Object... param)
stripColor - Condition to strip color codesinput - Target messageparam - Optional paramspublic String format(ConsoleColor color, String input, Object... param)
color - Target colorinput - Target messageparam - Optional paramspublic String stripColor(String input)
input - Target input@NotNull public @NotNull List<String> stripColor(@NotNull @NotNull List<String> list)
list - Target listpublic void addToList(List<String> list, String value, boolean condition)
list - Target listvalue - Target valuecondition - Required conditionpublic void addToList(List<Object> list, Object value, boolean condition)
list - Target listvalue - Target valuecondition - Required conditionpublic void addToList(List<Boolean> list, Boolean value, boolean condition)
list - Target listvalue - Target valuecondition - Required conditionCopyright © 2022. All rights reserved.