31 lines
842 B
Java
31 lines
842 B
Java
package com.songoda.epicenchants.utils;
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
public class Methods {
|
|
public static boolean isInt(String number) {
|
|
if (number == null || number.equals(""))
|
|
return false;
|
|
try {
|
|
Integer.parseInt(number);
|
|
} catch (NumberFormatException e) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static String formatText(String text) {
|
|
if (text == null || text.equals(""))
|
|
return "";
|
|
return formatText(text, false);
|
|
}
|
|
|
|
public static String formatText(String text, boolean cap) {
|
|
if (text == null || text.equals(""))
|
|
return "";
|
|
if (cap)
|
|
text = text.substring(0, 1).toUpperCase() + text.substring(1);
|
|
return ChatColor.translateAlternateColorCodes('&', text);
|
|
}
|
|
}
|