public class UniversalUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
UniversalUtils.OS |
Modifier and Type | Field and Description |
---|---|
static String |
BUNDLED_ASSETS_BASE |
static DateTimeFormatter |
GENERIC_DATE_TIME_FORMATTER |
static boolean |
HAVE_INTERNET |
static char[] |
HEX_DIGITS |
static UniversalUtils.OS |
os |
Constructor and Description |
---|
UniversalUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
containsChineseCharacters(String s)
Check if the given string contains a chinese characters
|
static @Nullable Path |
copyBundledFile(String name,
Path destFile)
Copies a bundled file to the file denoted by the given Path
|
static void |
doTrustToCertificates() |
static int |
floor(double d) |
static Optional<Cheat> |
getCheatFromItem(Object m) |
static Optional<Cheat> |
getCheatFromName(String s) |
static Optional<String> |
getContentFromURL(String url) |
static Optional<String> |
getContentFromURL(String urlName,
String post) |
static Optional<Integer> |
getFirstInt(String... args) |
static Optional<SemVer> |
getLatestVersion() |
static @Nullable SemVer |
getLatestVersionIfNewer() |
static Optional<String> |
getLatestVersionString() |
static int |
getMultipleOf(int i,
int multiple,
int more) |
static int |
getMultipleOf(int i,
int multiple,
int more,
int limit) |
static UniversalUtils.OS |
getOs() |
static int |
getPorcentFromBoolean(boolean b) |
static int |
getPorcentFromBoolean(boolean b,
int max) |
static int |
getPorcentFromBoolean(boolean b,
int max,
int min) |
static Optional<Special> |
getSpecialFromItem(Object m) |
static String |
hexToString(byte[] data) |
static void |
init() |
static boolean |
isInteger(String s) |
static boolean |
isLong(String s) |
static boolean |
isMe(String uuid) |
static boolean |
isMe(UUID uuid) |
static boolean |
isUUID(String s) |
static boolean |
isValidName(String name) |
static Configuration |
loadConfig(File configFile,
String configName) |
static @Nullable InputStream |
openBundledFile(String name)
Opens a bundled file as an InputStream
|
static int |
parseInPorcent(double i) |
static int |
parseInPorcent(int i) |
static String |
replacePlaceholders(String rawMessage,
Object... placeholders) |
static CompletableFuture<String> |
requestMcleaksData(String uuid) |
static byte[] |
stringToHex(String string) |
static int |
sum(HashMap<Integer,Integer> relia) |
static @Nullable String |
truncate(@Nullable String string,
int maxLength) |
public static final DateTimeFormatter GENERIC_DATE_TIME_FORMATTER
public static final String BUNDLED_ASSETS_BASE
public static final char[] HEX_DIGITS
public static boolean HAVE_INTERNET
public static UniversalUtils.OS os
public static int getMultipleOf(int i, int multiple, int more)
public static int getMultipleOf(int i, int multiple, int more, int limit)
public static int floor(double d)
public static int getPorcentFromBoolean(boolean b)
public static int getPorcentFromBoolean(boolean b, int max)
public static int getPorcentFromBoolean(boolean b, int max, int min)
public static int parseInPorcent(int i)
public static int parseInPorcent(double i)
public static boolean isMe(String uuid)
public static boolean isMe(UUID uuid)
public static boolean isInteger(String s)
public static boolean isLong(String s)
public static boolean isUUID(String s)
public static @Nullable SemVer getLatestVersionIfNewer()
public static CompletableFuture<String> requestMcleaksData(String uuid)
public static void doTrustToCertificates() throws KeyManagementException, NoSuchAlgorithmException
public static String replacePlaceholders(String rawMessage, Object... placeholders)
public static boolean isValidName(String name)
public static boolean containsChineseCharacters(String s)
s
- The string where we are looking for chinese charpublic static void init()
public static @Nullable InputStream openBundledFile(String name)
name
- the name of the bundled filepublic static @Nullable Path copyBundledFile(String name, Path destFile) throws IOException
name
- the name of the bundled filedestFile
- the file Path it will be copied toIOException
- if an IO exception occurredpublic static Configuration loadConfig(File configFile, String configName)
public static String hexToString(byte[] data)
public static byte[] stringToHex(String string)
public static UniversalUtils.OS getOs()