mirror of
https://github.com/plexusorg/Plex.git
synced 2025-06-27 22:16:41 +00:00
Use ComponentLogger + update dependencies
This commit is contained in:
@ -3,11 +3,12 @@ package dev.plex.util;
|
||||
import dev.plex.Plex;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
|
||||
|
||||
public class PlexLog
|
||||
{
|
||||
private static final ComponentLogger logger = ComponentLogger.logger("");
|
||||
|
||||
public static void log(String message, Object... strings)
|
||||
{
|
||||
for (int i = 0; i < strings.length; i++)
|
||||
@ -17,12 +18,12 @@ public class PlexLog
|
||||
message = message.replace("{" + i + "}", strings[i].toString());
|
||||
}
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.YELLOW + "[Plex] " + ChatColor.GRAY + "%s", message));
|
||||
logger.info(PlexUtils.mmDeserialize("<yellow>[Plex] <gray>" + message));
|
||||
}
|
||||
|
||||
public static void log(Component component)
|
||||
{
|
||||
Bukkit.getConsoleSender().sendMessage(Component.text("[Plex] ").color(NamedTextColor.YELLOW).append(component).colorIfAbsent(NamedTextColor.GRAY));
|
||||
logger.info(Component.text("[Plex] ").color(NamedTextColor.YELLOW).append(component).colorIfAbsent(NamedTextColor.GRAY));
|
||||
}
|
||||
|
||||
public static void error(String message, Object... strings)
|
||||
@ -34,8 +35,7 @@ public class PlexLog
|
||||
message = message.replace("{" + i + "}", strings[i].toString());
|
||||
}
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(PlexUtils.mmDeserialize("<red>[Plex Error] <gold>" + message));
|
||||
// Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.RED + "[Plex Error] " + ChatColor.GOLD + "%s", message));
|
||||
logger.error(PlexUtils.mmDeserialize("<red>[Plex Error] <gold>" + message));
|
||||
}
|
||||
|
||||
public static void warn(String message, Object... strings)
|
||||
@ -47,23 +47,21 @@ public class PlexLog
|
||||
message = message.replace("{" + i + "}", strings[i].toString());
|
||||
}
|
||||
}
|
||||
// Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.YELLOW + "[Plex Warning] " + ChatColor.GOLD + "%s", message));
|
||||
Bukkit.getConsoleSender().sendMessage(PlexUtils.mmDeserialize("<#eb7c0e>[Plex Warning] <gold>" + message));
|
||||
logger.warn(PlexUtils.mmDeserialize("<#eb7c0e>[Plex Warning] <gold>" + message));
|
||||
}
|
||||
|
||||
public static void debug(String message, Object... strings)
|
||||
{
|
||||
for (int i = 0; i < strings.length; i++)
|
||||
{
|
||||
if (message.contains("{" + i + "}"))
|
||||
{
|
||||
message = message.replace("{" + i + "}", strings[i].toString());
|
||||
}
|
||||
}
|
||||
if (Plex.get().config.getBoolean("debug"))
|
||||
{
|
||||
Bukkit.getConsoleSender().sendMessage(PlexUtils.mmDeserialize("<dark_purple>[Plex Debug] <gold>" + message));
|
||||
// Bukkit.getConsoleSender().sendMessage(String.format(ChatColor.DARK_PURPLE + "[Plex Debug] " + ChatColor.GOLD + "%s", message));
|
||||
for (int i = 0; i < strings.length; i++)
|
||||
{
|
||||
if (message.contains("{" + i + "}"))
|
||||
{
|
||||
message = message.replace("{" + i + "}", strings[i].toString());
|
||||
}
|
||||
}
|
||||
logger.info(PlexUtils.mmDeserialize("<dark_purple>[Plex Debug] <gold>" + message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class PlexUtils implements PlexBase
|
||||
{
|
||||
aprilFools = plugin.config.getBoolean("april_fools");
|
||||
}
|
||||
ZonedDateTime date = ZonedDateTime.now(ZoneId.of(TimeUtils.TIMEZONE));
|
||||
ZonedDateTime date = ZonedDateTime.now(ZoneId.systemDefault());
|
||||
if (aprilFools && date.getMonth() == Month.APRIL && date.getDayOfMonth() == 1)
|
||||
{
|
||||
Component component = MINI_MESSAGE.deserialize(input); // removes existing tags
|
||||
|
Reference in New Issue
Block a user