Use ComponentLogger + update dependencies

This commit is contained in:
Telesphoreo 2022-06-29 18:11:03 -05:00
parent 6763e12d81
commit 4a14f94158
3 changed files with 20 additions and 22 deletions

View File

@ -18,12 +18,12 @@ dependencies {
library "org.apache.maven.resolver:maven-resolver-connector-basic:1.8.0"
library "org.apache.maven.resolver:maven-resolver-transport-http:1.8.0"
library "org.apache.maven:maven-resolver-provider:3.8.5"
library "org.eclipse.jetty:jetty-server:11.0.9"
library "org.eclipse.jetty:jetty-servlet:11.0.9"
library "org.eclipse.jetty:jetty-proxy:11.0.9"
library "org.eclipse.jetty:jetty-server:11.0.11"
library "org.eclipse.jetty:jetty-servlet:11.0.11"
library "org.eclipse.jetty:jetty-proxy:11.0.11"
library "com.google.code.gson:gson:2.9.0"
compileOnly "io.papermc.paper:paper-api:1.19-R0.1-SNAPSHOT"
compileOnly("com.github.MilkBowl:VaultAPI:1.7") {
compileOnly("com.github.MilkBowl:VaultAPI:1.7.1") {
exclude group: "org.bukkit", module: "bukkit"
}
implementation "org.bstats:bstats-base:3.0.0"

View File

@ -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));
}
}
}

View File

@ -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