my colors in cmd prompt don't work :(

This commit is contained in:
spacerocket62 2020-10-28 12:14:44 -07:00
parent e716cee5bc
commit ed1abb1fc0
3 changed files with 18 additions and 6 deletions

View File

@ -13,6 +13,7 @@ import me.totalfreedom.plex.storage.MongoConnection;
import me.totalfreedom.plex.storage.RedisConnection;
import me.totalfreedom.plex.storage.SQLConnection;
import me.totalfreedom.plex.storage.StorageType;
import me.totalfreedom.plex.util.PlexLog;
import me.totalfreedom.plex.util.PlexUtils;
import org.bukkit.plugin.java.JavaPlugin;
@ -66,8 +67,17 @@ public class Plex extends JavaPlugin
public void onEnable()
{
config.load();
PlexLog.log("Loaded config.yml");
try {
PlexUtils.testConnections();
PlexLog.log("Connected to " + storageType.name().toUpperCase());
} catch (Exception e)
{
PlexLog.error("Failed to connect to " + storageType.name().toUpperCase());
e.printStackTrace();
}
if (storageType == StorageType.MONGO)
{
@ -84,6 +94,7 @@ public class Plex extends JavaPlugin
rankManager = new RankManager();
rankManager.generateDefaultRanks();
rankManager.importDefaultRanks();
PlexLog.log("Rank Manager initialized");
}

View File

@ -29,12 +29,12 @@ public enum Rank
public String getPrefix()
{
return prefix;
return ChatColor.translateAlternateColorCodes('&', prefix);
}
public String getLoginMSG()
{
return loginMessage;
return ChatColor.translateAlternateColorCodes('&', loginMessage);
}
public int getLevel() {

View File

@ -1,16 +1,17 @@
package me.totalfreedom.plex.util;
import me.totalfreedom.plex.Plex;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
public class PlexLog
{
public static void log(String message)
{
Plex.get().getServer().getConsoleSender().sendMessage(String.format("§e[Plex] §7%s", message));
Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.YELLOW + "[Plex] " + ChatColor.GRAY + "%s", message));
}
public static void error(String message)
{
Plex.get().getServer().getConsoleSender().sendMessage(String.format("§c[Plex Error] §6%s", message));
Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.RED + "[Plex Error]" + ChatColor.GOLD + "%s", message));
}
}