Split gcmd sub cmds out n other stuff

This commit is contained in:
Seth
2020-07-31 21:10:44 -07:00
parent 891e5c2f12
commit 76bb2d08ac
21 changed files with 431 additions and 255 deletions

View File

@ -26,6 +26,15 @@ public class FLog
log(Level.INFO, ex);
}
// Fuck spigot for not using log4j, we would of had a debug log level if they did
public static void debug(String message)
{
if (FUtil.inDeveloperMode())
{
log(Level.INFO, "\u001B[35m[TotalFreedomMod | DEBUG] " + message + "\u001B[0m", true);
}
}
// Level.WARNING:
public static void warning(String message)
{

View File

@ -126,6 +126,11 @@ public class FUtil
return FUtil.DEVELOPERS.contains(name);
}
public static boolean inDeveloperMode()
{
return ConfigEntry.DEVELOPER_MODE.getBoolean();
}
public static String formatName(String name)
{
return WordUtils.capitalizeFully(name.replace("_", " "));
@ -133,11 +138,7 @@ public class FUtil
public static String showS(int count)
{
if (count == 1)
{
return "";
}
return "s";
return (count == 1 ? "" : "s");
}
public static List<String> getPlayerList()
@ -760,6 +761,16 @@ public class FUtil
return Color.fromRGB((int) c1values[0], (int) c1values[1], (int) c1values[2]);
}
public static boolean isValidIPv4(String ip)
{
if (ip.matches("^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$")
|| ip.matches("^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([*])\\.([*])$"))
{
return true;
}
return false;
}
public static List<Color> createColorGradient(Color c1, Color c2, int steps)
{
double factor = 1.0 / (steps - 1.0);