fancynpcs: Update logger to 0.0.7

This commit is contained in:
Oliver
2025-08-30 14:57:45 +02:00
parent c65f8c03bf
commit d176f09aa0
7 changed files with 15 additions and 21 deletions

View File

@@ -77,7 +77,7 @@ dependencies {
compileOnly("org.lushplugins:ChatColorHandler:6.0.0") compileOnly("org.lushplugins:ChatColorHandler:6.0.0")
implementation("de.oliver.FancyAnalytics:java-sdk:0.0.4") implementation("de.oliver.FancyAnalytics:java-sdk:0.0.4")
implementation("de.oliver.FancyAnalytics:mc-api:0.1.9") implementation("de.oliver.FancyAnalytics:mc-api:0.1.9")
implementation("de.oliver.FancyAnalytics:logger:0.0.6") implementation("de.oliver.FancyAnalytics:logger:0.0.7")
implementation("org.incendo:cloud-core:2.1.0-SNAPSHOT") implementation("org.incendo:cloud-core:2.1.0-SNAPSHOT")
implementation("org.incendo:cloud-paper:2.0.0-beta.11") implementation("org.incendo:cloud-paper:2.0.0-beta.11")
implementation("org.incendo:cloud-annotations:2.1.0-SNAPSHOT") implementation("org.incendo:cloud-annotations:2.1.0-SNAPSHOT")

View File

@@ -10,6 +10,7 @@ import de.oliver.fancyanalytics.logger.LogLevel;
import de.oliver.fancyanalytics.logger.appender.Appender; import de.oliver.fancyanalytics.logger.appender.Appender;
import de.oliver.fancyanalytics.logger.appender.ConsoleAppender; import de.oliver.fancyanalytics.logger.appender.ConsoleAppender;
import de.oliver.fancyanalytics.logger.appender.JsonAppender; import de.oliver.fancyanalytics.logger.appender.JsonAppender;
import de.oliver.fancyanalytics.logger.properties.ThrowableProperty;
import de.oliver.fancyanalytics.sdk.events.Event; import de.oliver.fancyanalytics.sdk.events.Event;
import de.oliver.fancylib.FancyLib; import de.oliver.fancylib.FancyLib;
import de.oliver.fancylib.Metrics; import de.oliver.fancylib.Metrics;
@@ -323,12 +324,7 @@ public class FancyNpcs extends JavaPlugin implements FancyNpcsPlugin {
npc.spawnForAll(); npc.spawnForAll();
} }
} catch (final Throwable thr) { } catch (final Throwable thr) {
fancyLogger.error( fancyLogger.error("An error occurred while updating '" + npc.getData().getName() + "' NPC.", ThrowableProperty.of(thr));
"An error occurred while updating '" + npc.getData().getName() + "' NPC."
+ System.lineSeparator() + " (1) " + thr.getClass().getName() + ": " + thr.getMessage()
+ (thr.getCause() != null ? System.lineSeparator() + " (2) " + thr.getCause().getClass().getName() + ": " + thr.getCause().getMessage() : "")
);
fancyLogger.error(thr);
} }
} }
}, 30, npcUpdateInterval, TimeUnit.SECONDS); }, 30, npcUpdateInterval, TimeUnit.SECONDS);

View File

@@ -1,6 +1,7 @@
package de.oliver.fancynpcs; package de.oliver.fancynpcs;
import de.oliver.fancyanalytics.logger.ExtendedFancyLogger; import de.oliver.fancyanalytics.logger.ExtendedFancyLogger;
import de.oliver.fancyanalytics.logger.properties.ThrowableProperty;
import de.oliver.fancylib.serverSoftware.ServerSoftware; import de.oliver.fancylib.serverSoftware.ServerSoftware;
import de.oliver.fancynpcs.api.Npc; import de.oliver.fancynpcs.api.Npc;
import de.oliver.fancynpcs.api.NpcAttribute; import de.oliver.fancynpcs.api.NpcAttribute;
@@ -66,8 +67,7 @@ public class NpcManagerImpl implements NpcManager {
try { try {
npcConfig.save(npcConfigFile); npcConfig.save(npcConfigFile);
} catch (IOException e) { } catch (IOException e) {
logger.error("Could not save npc config file"); logger.error("Could not save npc config file", ThrowableProperty.of(e));
logger.error(e);
} }
} }
@@ -129,8 +129,7 @@ public class NpcManagerImpl implements NpcManager {
try { try {
npcConfigFile.createNewFile(); npcConfigFile.createNewFile();
} catch (IOException e) { } catch (IOException e) {
logger.error("Could not create npc config file"); logger.error("Could not create npc config file", ThrowableProperty.of(e));
logger.error(e);
return; return;
} }
} }
@@ -441,7 +440,7 @@ public class NpcManagerImpl implements NpcManager {
this.setLoaded(); this.setLoaded();
} }
private void setLoaded(){ private void setLoaded() {
isLoaded = true; isLoaded = true;
new NpcsLoadedEvent().callEvent(); new NpcsLoadedEvent().callEvent();
} }

View File

@@ -1,5 +1,6 @@
package de.oliver.fancynpcs.skins.cache; package de.oliver.fancynpcs.skins.cache;
import de.oliver.fancyanalytics.logger.properties.ThrowableProperty;
import de.oliver.fancynpcs.FancyNpcs; import de.oliver.fancynpcs.FancyNpcs;
import de.oliver.fancynpcs.api.skins.SkinData; import de.oliver.fancynpcs.api.skins.SkinData;
import de.oliver.jdb.JDB; import de.oliver.jdb.JDB;
@@ -23,8 +24,7 @@ public class SkinCacheFile implements SkinCache {
try { try {
skinCacheData = this.storage.get("skins/" + b64ID, SkinCacheData.class); skinCacheData = this.storage.get("skins/" + b64ID, SkinCacheData.class);
} catch (IOException e) { } catch (IOException e) {
FancyNpcs.getInstance().getFancyLogger().error("Failed to load skin cache"); FancyNpcs.getInstance().getFancyLogger().error("Failed to load skin cache", ThrowableProperty.of(e));
FancyNpcs.getInstance().getFancyLogger().error(e);
} }
if (skinCacheData == null) { if (skinCacheData == null) {
@@ -47,8 +47,7 @@ public class SkinCacheFile implements SkinCache {
String b64ID = Base64.getEncoder().encodeToString(skin.getIdentifier().getBytes()); String b64ID = Base64.getEncoder().encodeToString(skin.getIdentifier().getBytes());
this.storage.set("skins/" + b64ID, skinCacheData); this.storage.set("skins/" + b64ID, skinCacheData);
} catch (IOException e) { } catch (IOException e) {
FancyNpcs.getInstance().getFancyLogger().error("Failed to save skin cache"); FancyNpcs.getInstance().getFancyLogger().error("Failed to save skin cache", ThrowableProperty.of(e));
FancyNpcs.getInstance().getFancyLogger().error(e);
} }
} }

View File

@@ -1,6 +1,7 @@
package de.oliver.fancynpcs.skins.mojang; package de.oliver.fancynpcs.skins.mojang;
import com.google.gson.Gson; import com.google.gson.Gson;
import de.oliver.fancyanalytics.logger.properties.ThrowableProperty;
import de.oliver.fancynpcs.api.FancyNpcsPlugin; import de.oliver.fancynpcs.api.FancyNpcsPlugin;
import de.oliver.fancynpcs.api.skins.SkinData; import de.oliver.fancynpcs.api.skins.SkinData;
import de.oliver.fancynpcs.skins.mineskin.RatelimitException; import de.oliver.fancynpcs.skins.mineskin.RatelimitException;
@@ -51,8 +52,7 @@ public class MojangAPI {
} catch (RatelimitException e) { } catch (RatelimitException e) {
throw e; // rethrow throw e; // rethrow
} catch (Exception e) { } catch (Exception e) {
FancyNpcsPlugin.get().getFancyLogger().warn("Failed to fetch skin from Mojang API for " + uuid); FancyNpcsPlugin.get().getFancyLogger().warn("Failed to fetch skin from Mojang API for " + uuid, ThrowableProperty.of(e));
FancyNpcsPlugin.get().getFancyLogger().warn(e);
return null; return null;
} }
} }

View File

@@ -1,6 +1,7 @@
package de.oliver.fancynpcs.skins.uuidcache; package de.oliver.fancynpcs.skins.uuidcache;
import com.google.gson.Gson; import com.google.gson.Gson;
import de.oliver.fancyanalytics.logger.properties.ThrowableProperty;
import de.oliver.fancynpcs.FancyNpcs; import de.oliver.fancynpcs.FancyNpcs;
import de.oliver.jdb.JDB; import de.oliver.jdb.JDB;
@@ -34,8 +35,7 @@ public class UUIDFileCache implements UUIDCache {
try { try {
uuids = this.storage.get("uuids", UUIDCacheData[].class); uuids = this.storage.get("uuids", UUIDCacheData[].class);
} catch (IOException e) { } catch (IOException e) {
FancyNpcs.getInstance().getFancyLogger().error("Failed to load UUID cache"); FancyNpcs.getInstance().getFancyLogger().error("Failed to load UUID cache", ThrowableProperty.of(e));
FancyNpcs.getInstance().getFancyLogger().error(e);
return; return;
} }

View File

@@ -27,7 +27,7 @@ public class JsonNametagStore implements NametagStore {
try { try {
jdb.set(context.getName() + "/" + id, nametag); jdb.set(context.getName() + "/" + id, nametag);
} catch (IOException e) { } catch (IOException e) {
FancyVisuals.getFancyLogger().error("Failed to set nametag for id " + id); FancyVisuals.getFancyLogger().error("Failed to set nametag for id " + id, ThrowableProperty.of(e));
FancyVisuals.getFancyLogger().error(e); FancyVisuals.getFancyLogger().error(e);
} }
} }