Replace ErrorHandler usage with ErrorLogger

This was done to get deprecation to show up where context is not
given to the error logger.
This commit is contained in:
Risto Lahtela 2020-05-14 16:57:29 +03:00
parent d09a4016d3
commit e53b9f1602
99 changed files with 532 additions and 557 deletions

View File

@ -5,6 +5,7 @@ repositories {
} }
dependencies { dependencies {
compileOnly project(":common")
compile project(path: ":common", configuration: 'shadow') compile project(path: ":common", configuration: 'shadow')
compileOnly project(":api") compileOnly project(":api")

View File

@ -20,8 +20,8 @@ import com.djrapitops.plan.gathering.ServerShutdownSave;
import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.utilities.java.Reflection; import com.djrapitops.plan.utilities.java.Reflection;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -39,9 +39,9 @@ public class BukkitServerShutdownSave extends ServerShutdownSave {
Locale locale, Locale locale,
DBSystem dbSystem, DBSystem dbSystem,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super(locale, dbSystem, logger, errorHandler); super(locale, dbSystem, logger, errorLogger);
} }
@Override @Override

View File

@ -18,7 +18,7 @@ package com.djrapitops.plan.addons.placeholderapi;
import com.djrapitops.plan.PlanSystem; import com.djrapitops.plan.PlanSystem;
import com.djrapitops.plan.placeholder.PlanPlaceholders; import com.djrapitops.plan.placeholder.PlanPlaceholders;
import com.djrapitops.plugin.logging.error.ErrorHandler; import com.djrapitops.plan.utilities.logging.ErrorLogger;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -28,20 +28,20 @@ public class BukkitPlaceholderRegistrar {
private final PlanPlaceholders placeholders; private final PlanPlaceholders placeholders;
private final PlanSystem system; private final PlanSystem system;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public BukkitPlaceholderRegistrar( public BukkitPlaceholderRegistrar(
PlanPlaceholders placeholders, PlanPlaceholders placeholders,
PlanSystem system, PlanSystem system,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.placeholders = placeholders; this.placeholders = placeholders;
this.system = system; this.system = system;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
public void register() { public void register() {
new PlanPlaceholderExtension(placeholders, system, errorHandler).register(); new PlanPlaceholderExtension(placeholders, system, errorLogger).register();
} }
} }

View File

@ -18,9 +18,9 @@ package com.djrapitops.plan.addons.placeholderapi;
import com.djrapitops.plan.PlanSystem; import com.djrapitops.plan.PlanSystem;
import com.djrapitops.plan.placeholder.PlanPlaceholders; import com.djrapitops.plan.placeholder.PlanPlaceholders;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plan.version.VersionChecker; import com.djrapitops.plan.version.VersionChecker;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import me.clip.placeholderapi.PlaceholderAPIPlugin; import me.clip.placeholderapi.PlaceholderAPIPlugin;
import me.clip.placeholderapi.expansion.PlaceholderExpansion; import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -34,18 +34,18 @@ import java.util.Collections;
*/ */
public class PlanPlaceholderExtension extends PlaceholderExpansion { public class PlanPlaceholderExtension extends PlaceholderExpansion {
public final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final VersionChecker versionChecker; private final VersionChecker versionChecker;
private final PlanPlaceholders placeholders; private final PlanPlaceholders placeholders;
public PlanPlaceholderExtension( public PlanPlaceholderExtension(
PlanPlaceholders placeholders, PlanPlaceholders placeholders,
PlanSystem system, PlanSystem system,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.placeholders = placeholders; this.placeholders = placeholders;
this.versionChecker = system.getVersionChecker(); this.versionChecker = system.getVersionChecker();
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Override @Override
@ -92,7 +92,7 @@ public class PlanPlaceholderExtension extends PlaceholderExpansion {
return value; return value;
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, getClass(), e); errorLogger.log(L.WARN, getClass(), e);
return null; return null;
} }
} }

View File

@ -19,8 +19,8 @@ package com.djrapitops.plan.gathering.listeners.bukkit;
import com.djrapitops.plan.gathering.afk.AFKTracker; import com.djrapitops.plan.gathering.afk.AFKTracker;
import com.djrapitops.plan.settings.Permissions; import com.djrapitops.plan.settings.Permissions;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -46,11 +46,11 @@ public class BukkitAFKListener implements Listener {
static AFKTracker AFK_TRACKER; static AFKTracker AFK_TRACKER;
private final Map<UUID, Boolean> ignorePermissionInfo; private final Map<UUID, Boolean> ignorePermissionInfo;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public BukkitAFKListener(PlanConfig config, ErrorHandler errorHandler) { public BukkitAFKListener(PlanConfig config, ErrorLogger errorLogger) {
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
this.ignorePermissionInfo = new HashMap<>(); this.ignorePermissionInfo = new HashMap<>();
BukkitAFKListener.assignAFKTracker(config); BukkitAFKListener.assignAFKTracker(config);
@ -79,7 +79,7 @@ public class BukkitAFKListener implements Listener {
AFK_TRACKER.performedAction(uuid, time); AFK_TRACKER.performedAction(uuid, time);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -21,8 +21,8 @@ import com.djrapitops.plan.gathering.cache.NicknameCache;
import com.djrapitops.plan.identification.ServerInfo; import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.transactions.events.NicknameStoreTransaction; import com.djrapitops.plan.storage.database.transactions.events.NicknameStoreTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -42,19 +42,19 @@ public class ChatListener implements Listener {
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final NicknameCache nicknameCache; private final NicknameCache nicknameCache;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public ChatListener( public ChatListener(
ServerInfo serverInfo, ServerInfo serverInfo,
DBSystem dbSystem, DBSystem dbSystem,
NicknameCache nicknameCache, NicknameCache nicknameCache,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.nicknameCache = nicknameCache; this.nicknameCache = nicknameCache;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
@ -66,7 +66,7 @@ public class ChatListener implements Listener {
try { try {
actOnChatEvent(event); actOnChatEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -23,8 +23,8 @@ import com.djrapitops.plan.gathering.domain.Session;
import com.djrapitops.plan.processing.Processing; import com.djrapitops.plan.processing.Processing;
import com.djrapitops.plan.processing.processors.player.MobKillProcessor; import com.djrapitops.plan.processing.processors.player.MobKillProcessor;
import com.djrapitops.plan.processing.processors.player.PlayerKillProcessor; import com.djrapitops.plan.processing.processors.player.PlayerKillProcessor;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -46,15 +46,15 @@ import java.util.UUID;
public class DeathEventListener implements Listener { public class DeathEventListener implements Listener {
private final Processing processing; private final Processing processing;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public DeathEventListener( public DeathEventListener(
Processing processing, Processing processing,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.processing = processing; this.processing = processing;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -80,7 +80,7 @@ public class DeathEventListener implements Listener {
UUID uuid = dead instanceof Player ? dead.getUniqueId() : null; UUID uuid = dead instanceof Player ? dead.getUniqueId() : null;
handleKill(time, uuid, killerEntity); handleKill(time, uuid, killerEntity);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -22,8 +22,8 @@ import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.settings.config.WorldAliasSettings; import com.djrapitops.plan.settings.config.WorldAliasSettings;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction; import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -44,19 +44,19 @@ public class GameModeChangeListener implements Listener {
private final WorldAliasSettings worldAliasSettings; private final WorldAliasSettings worldAliasSettings;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public GameModeChangeListener( public GameModeChangeListener(
WorldAliasSettings worldAliasSettings, WorldAliasSettings worldAliasSettings,
ServerInfo serverInfo, ServerInfo serverInfo,
DBSystem dbSystem, DBSystem dbSystem,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.worldAliasSettings = worldAliasSettings; this.worldAliasSettings = worldAliasSettings;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
@ -67,7 +67,7 @@ public class GameModeChangeListener implements Listener {
try { try {
actOnEvent(event); actOnEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -36,8 +36,8 @@ import com.djrapitops.plan.settings.config.paths.ExportSettings;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.transactions.events.*; import com.djrapitops.plan.storage.database.transactions.events.*;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -67,7 +67,7 @@ public class PlayerOnlineListener implements Listener {
private final GeolocationCache geolocationCache; private final GeolocationCache geolocationCache;
private final NicknameCache nicknameCache; private final NicknameCache nicknameCache;
private final SessionCache sessionCache; private final SessionCache sessionCache;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final Status status; private final Status status;
@Inject @Inject
@ -82,7 +82,7 @@ public class PlayerOnlineListener implements Listener {
NicknameCache nicknameCache, NicknameCache nicknameCache,
SessionCache sessionCache, SessionCache sessionCache,
Status status, Status status,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.config = config; this.config = config;
this.processing = processing; this.processing = processing;
@ -94,7 +94,7 @@ public class PlayerOnlineListener implements Listener {
this.nicknameCache = nicknameCache; this.nicknameCache = nicknameCache;
this.sessionCache = sessionCache; this.sessionCache = sessionCache;
this.status = status; this.status = status;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
@ -107,7 +107,7 @@ public class PlayerOnlineListener implements Listener {
dbSystem.getDatabase().executeTransaction(new BanStatusTransaction(playerUUID, () -> banned)); dbSystem.getDatabase().executeTransaction(new BanStatusTransaction(playerUUID, () -> banned));
dbSystem.getDatabase().executeTransaction(new OperatorStatusTransaction(playerUUID, operator)); dbSystem.getDatabase().executeTransaction(new OperatorStatusTransaction(playerUUID, operator));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }
@ -132,7 +132,7 @@ public class PlayerOnlineListener implements Listener {
dbSystem.getDatabase().executeTransaction(new KickStoreTransaction(uuid)); dbSystem.getDatabase().executeTransaction(new KickStoreTransaction(uuid));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }
@ -141,7 +141,7 @@ public class PlayerOnlineListener implements Listener {
try { try {
actOnJoinEvent(event); actOnJoinEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }
@ -205,7 +205,7 @@ public class PlayerOnlineListener implements Listener {
try { try {
actOnQuitEvent(event); actOnQuitEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -22,8 +22,8 @@ import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.settings.config.WorldAliasSettings; import com.djrapitops.plan.settings.config.WorldAliasSettings;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction; import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -39,19 +39,19 @@ public class WorldChangeListener implements Listener {
private final WorldAliasSettings worldAliasSettings; private final WorldAliasSettings worldAliasSettings;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public WorldChangeListener( public WorldChangeListener(
WorldAliasSettings worldAliasSettings, WorldAliasSettings worldAliasSettings,
ServerInfo serverInfo, ServerInfo serverInfo,
DBSystem dbSystem, DBSystem dbSystem,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.worldAliasSettings = worldAliasSettings; this.worldAliasSettings = worldAliasSettings;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
@ -59,7 +59,7 @@ public class WorldChangeListener implements Listener {
try { try {
actOnEvent(event); actOnEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -19,10 +19,10 @@ package com.djrapitops.plan.gathering.listeners;
import com.djrapitops.plan.gathering.listeners.bukkit.BukkitAFKListener; import com.djrapitops.plan.gathering.listeners.bukkit.BukkitAFKListener;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.TimeSettings; import com.djrapitops.plan.settings.config.paths.TimeSettings;
import com.djrapitops.plugin.logging.console.TestPluginLogger; import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.error.ConsoleErrorLogger;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -43,12 +43,19 @@ import static org.mockito.Mockito.*;
public class BukkitAFKListenerTest { public class BukkitAFKListenerTest {
private static BukkitAFKListener underTest; private static BukkitAFKListener underTest;
private static ErrorLogger errorLogger;
@BeforeAll @BeforeAll
static void setUp() { static void setUp() {
PlanConfig config = Mockito.mock(PlanConfig.class); PlanConfig config = Mockito.mock(PlanConfig.class);
when(config.get(TimeSettings.AFK_THRESHOLD)).thenReturn(TimeUnit.MINUTES.toMillis(3)); when(config.get(TimeSettings.AFK_THRESHOLD)).thenReturn(TimeUnit.MINUTES.toMillis(3));
underTest = new BukkitAFKListener(config, new ConsoleErrorLogger(new TestPluginLogger())); errorLogger = Mockito.mock(ErrorLogger.class);
underTest = new BukkitAFKListener(config, errorLogger);
}
@AfterEach
void ensureNoErrors() {
verifyNoInteractions(errorLogger);
} }
@Test @Test

View File

@ -1,4 +1,5 @@
dependencies { dependencies {
compileOnly project(":common")
compile project(path: ":common", configuration: 'shadow') compile project(path: ":common", configuration: 'shadow')
compileOnly project(":api") compileOnly project(":api")

View File

@ -34,8 +34,8 @@ import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.transactions.events.GeoInfoStoreTransaction; import com.djrapitops.plan.storage.database.transactions.events.GeoInfoStoreTransaction;
import com.djrapitops.plan.storage.database.transactions.events.PlayerRegisterTransaction; import com.djrapitops.plan.storage.database.transactions.events.PlayerRegisterTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PostLoginEvent; import net.md_5.bungee.api.event.PostLoginEvent;
@ -63,7 +63,7 @@ public class PlayerOnlineListener implements Listener {
private final GeolocationCache geolocationCache; private final GeolocationCache geolocationCache;
private final SessionCache sessionCache; private final SessionCache sessionCache;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public PlayerOnlineListener( public PlayerOnlineListener(
@ -74,7 +74,7 @@ public class PlayerOnlineListener implements Listener {
Exporter exporter, GeolocationCache geolocationCache, Exporter exporter, GeolocationCache geolocationCache,
SessionCache sessionCache, SessionCache sessionCache,
ServerInfo serverInfo, ServerInfo serverInfo,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.config = config; this.config = config;
this.processing = processing; this.processing = processing;
@ -84,7 +84,7 @@ public class PlayerOnlineListener implements Listener {
this.geolocationCache = geolocationCache; this.geolocationCache = geolocationCache;
this.sessionCache = sessionCache; this.sessionCache = sessionCache;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
@ -92,7 +92,7 @@ public class PlayerOnlineListener implements Listener {
try { try {
actOnLogin(event); actOnLogin(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }
@ -142,7 +142,7 @@ public class PlayerOnlineListener implements Listener {
try { try {
actOnLogout(event); actOnLogout(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }
@ -179,7 +179,7 @@ public class PlayerOnlineListener implements Listener {
try { try {
actOnServerSwitch(event); actOnServerSwitch(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }

View File

@ -37,12 +37,12 @@ import com.djrapitops.plan.settings.SettingsSvc;
import com.djrapitops.plan.settings.locale.LocaleSystem; import com.djrapitops.plan.settings.locale.LocaleSystem;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.file.PlanFiles; import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plan.version.VersionChecker; import com.djrapitops.plan.version.VersionChecker;
import com.djrapitops.plugin.benchmarking.Benchmark; import com.djrapitops.plugin.benchmarking.Benchmark;
import com.djrapitops.plugin.benchmarking.Timings; import com.djrapitops.plugin.benchmarking.Timings;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -82,7 +82,7 @@ public class PlanSystem implements SubSystem {
private final SettingsSvc settingsService; private final SettingsSvc settingsService;
private final PluginLogger logger; private final PluginLogger logger;
private final Timings timings; private final Timings timings;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public PlanSystem( public PlanSystem(
@ -107,7 +107,7 @@ public class PlanSystem implements SubSystem {
SettingsSvc settingsService, SettingsSvc settingsService,
PluginLogger logger, PluginLogger logger,
Timings timings, Timings timings,
ErrorHandler errorHandler, ErrorLogger errorLogger,
PlanAPI.PlanAPIHolder apiHolder PlanAPI.PlanAPIHolder apiHolder
) { ) {
this.files = files; this.files = files;
@ -131,7 +131,7 @@ public class PlanSystem implements SubSystem {
this.settingsService = settingsService; this.settingsService = settingsService;
this.logger = logger; this.logger = logger;
this.timings = timings; this.timings = timings;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
logger.log(L.INFO_COLOR, logger.log(L.INFO_COLOR,
"", "",
@ -175,7 +175,7 @@ public class PlanSystem implements SubSystem {
// Disables Webserver if Proxy is detected in the database // Disables Webserver if Proxy is detected in the database
if (serverInfo.getServer().isNotProxy()) { if (serverInfo.getServer().isNotProxy()) {
processing.submitNonCritical(new NonProxyWebserverDisableChecker( processing.submitNonCritical(new NonProxyWebserverDisableChecker(
configSystem.getConfig(), webServerSystem.getAddresses(), webServerSystem, logger, errorHandler configSystem.getConfig(), webServerSystem.getAddresses(), webServerSystem, logger, errorLogger
)); ));
} }
@ -222,7 +222,7 @@ public class PlanSystem implements SubSystem {
system.disable(); system.disable();
} }
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }
} }
@ -292,4 +292,8 @@ public class PlanSystem implements SubSystem {
public ExtensionService getExtensionService() { public ExtensionService getExtensionService() {
return extensionService; return extensionService;
} }
public ErrorLogger getErrorLogger() {
return errorLogger;
}
} }

View File

@ -27,9 +27,9 @@ import com.djrapitops.plan.storage.database.queries.Query;
import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries; import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries;
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
import com.djrapitops.plan.storage.database.queries.objects.UserIdentifierQueries; import com.djrapitops.plan.storage.database.queries.objects.UserIdentifierQueries;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -51,19 +51,19 @@ public class CommonAPI implements PlanAPI {
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final UUIDUtility uuidUtility; private final UUIDUtility uuidUtility;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public CommonAPI( public CommonAPI(
DBSystem dbSystem, DBSystem dbSystem,
UUIDUtility uuidUtility, UUIDUtility uuidUtility,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.uuidUtility = uuidUtility; this.uuidUtility = uuidUtility;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
PlanAPIHolder.set(this); PlanAPIHolder.set(this);
} }
@ -94,7 +94,7 @@ public class CommonAPI implements PlanAPI {
try { try {
return queryDB(UserIdentifierQueries.fetchAllPlayerNames()); return queryDB(UserIdentifierQueries.fetchAllPlayerNames());
} catch (DBOpException e) { } catch (DBOpException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
return new HashMap<>(); return new HashMap<>();
} }
} }

View File

@ -21,8 +21,8 @@ import com.djrapitops.plan.api.data.ServerContainer;
import com.djrapitops.plan.data.plugin.PluginData; import com.djrapitops.plan.data.plugin.PluginData;
import com.djrapitops.plan.identification.UUIDUtility; import com.djrapitops.plan.identification.UUIDUtility;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -58,9 +58,9 @@ public interface PlanAPI {
DBSystem dbSystem, DBSystem dbSystem,
UUIDUtility uuidUtility, UUIDUtility uuidUtility,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
set(new CommonAPI(dbSystem, uuidUtility, logger, errorHandler)); set(new CommonAPI(dbSystem, uuidUtility, logger, errorLogger));
} }
} }

View File

@ -34,12 +34,12 @@ import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries; import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.CommandUtils; import com.djrapitops.plugin.command.CommandUtils;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -60,7 +60,7 @@ public class AnalyzeCommand extends CommandNode {
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final WebServer webServer; private final WebServer webServer;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public AnalyzeCommand( public AnalyzeCommand(
@ -71,7 +71,7 @@ public class AnalyzeCommand extends CommandNode {
ServerInfo serverInfo, ServerInfo serverInfo,
WebServer webServer, WebServer webServer,
DBSystem dbSystem, DBSystem dbSystem,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("analyze|analyse|analysis|a", Permissions.ANALYZE.getPermission(), CommandType.CONSOLE); super("analyze|analyse|analysis|a", Permissions.ANALYZE.getPermission(), CommandType.CONSOLE);
@ -82,7 +82,7 @@ public class AnalyzeCommand extends CommandNode {
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.webServer = webServer; this.webServer = webServer;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setShortHelp(locale.getString(CmdHelpLang.ANALYZE)); setShortHelp(locale.getString(CmdHelpLang.ANALYZE));
setInDepthHelp(locale.getArray(DeepHelpLang.ANALYZE)); setInDepthHelp(locale.getArray(DeepHelpLang.ANALYZE));
@ -106,7 +106,7 @@ public class AnalyzeCommand extends CommandNode {
sendLink(server, sender); sendLink(server, sender);
} catch (DBOpException | ExportException e) { } catch (DBOpException | ExportException e) {
sender.sendMessage("§cError occurred: " + e.toString()); sender.sendMessage("§cError occurred: " + e.toString());
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
}); });
} }

View File

@ -32,12 +32,12 @@ import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.PlayerFetchQueries; import com.djrapitops.plan.storage.database.queries.PlayerFetchQueries;
import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries; import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries;
import com.djrapitops.plan.utilities.MiscUtils; import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.CommandUtils; import com.djrapitops.plugin.command.CommandUtils;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.UUID; import java.util.UUID;
@ -55,7 +55,7 @@ public class InspectCommand extends CommandNode {
private final Addresses addresses; private final Addresses addresses;
private final Processing processing; private final Processing processing;
private final UUIDUtility uuidUtility; private final UUIDUtility uuidUtility;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public InspectCommand( public InspectCommand(
@ -65,7 +65,7 @@ public class InspectCommand extends CommandNode {
DBSystem dbSystem, DBSystem dbSystem,
WebServer webServer, WebServer webServer,
UUIDUtility uuidUtility, UUIDUtility uuidUtility,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("inspect", Permissions.INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS); super("inspect", Permissions.INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS);
this.addresses = addresses; this.addresses = addresses;
@ -76,7 +76,7 @@ public class InspectCommand extends CommandNode {
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.webServer = webServer; this.webServer = webServer;
this.uuidUtility = uuidUtility; this.uuidUtility = uuidUtility;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setShortHelp(locale.getString(CmdHelpLang.INSPECT)); setShortHelp(locale.getString(CmdHelpLang.INSPECT));
setInDepthHelp(locale.getArray(DeepHelpLang.INSPECT)); setInDepthHelp(locale.getArray(DeepHelpLang.INSPECT));
@ -117,7 +117,7 @@ public class InspectCommand extends CommandNode {
this.sendInspectMsg(sender, playerName); this.sendInspectMsg(sender, playerName);
} catch (DBOpException e) { } catch (DBOpException e) {
sender.sendMessage("§eDatabase exception occurred: " + e.getMessage()); sender.sendMessage("§eDatabase exception occurred: " + e.getMessage());
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
}); });
} }

View File

@ -27,12 +27,12 @@ import com.djrapitops.plan.settings.locale.lang.DeepHelpLang;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.ColorScheme; import com.djrapitops.plugin.command.ColorScheme;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.ArrayList; import java.util.ArrayList;
@ -49,21 +49,21 @@ public class ListServersCommand extends CommandNode {
private final Locale locale; private final Locale locale;
private final ColorScheme colorScheme; private final ColorScheme colorScheme;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public ListServersCommand( public ListServersCommand(
Locale locale, Locale locale,
ColorScheme colorScheme, ColorScheme colorScheme,
DBSystem dbSystem, DBSystem dbSystem,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("servers|serverlist|listservers|sl|ls", Permissions.MANAGE.getPermission(), CommandType.CONSOLE); super("servers|serverlist|listservers|sl|ls", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
this.locale = locale; this.locale = locale;
this.colorScheme = colorScheme; this.colorScheme = colorScheme;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setShortHelp(locale.getString(CmdHelpLang.SERVERS)); setShortHelp(locale.getString(CmdHelpLang.SERVERS));
setInDepthHelp(locale.getArray(DeepHelpLang.SERVERS)); setInDepthHelp(locale.getArray(DeepHelpLang.SERVERS));
@ -86,7 +86,7 @@ public class ListServersCommand extends CommandNode {
sender.sendMessage(">"); sender.sendMessage(">");
} catch (DBOpException e) { } catch (DBOpException e) {
sender.sendMessage("§cDatabase Exception occurred."); sender.sendMessage("§cDatabase Exception occurred.");
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }

View File

@ -40,11 +40,11 @@ import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries; import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries;
import com.djrapitops.plan.utilities.MiscUtils; import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -67,7 +67,7 @@ public class QInspectCommand extends CommandNode {
private final Processing processing; private final Processing processing;
private final Formatters formatters; private final Formatters formatters;
private final UUIDUtility uuidUtility; private final UUIDUtility uuidUtility;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public QInspectCommand( public QInspectCommand(
@ -77,7 +77,7 @@ public class QInspectCommand extends CommandNode {
DBSystem dbSystem, DBSystem dbSystem,
UUIDUtility uuidUtility, UUIDUtility uuidUtility,
Formatters formatters, Formatters formatters,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("qinspect", Permissions.QUICK_INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS); super("qinspect", Permissions.QUICK_INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS);
this.config = config; this.config = config;
@ -88,7 +88,7 @@ public class QInspectCommand extends CommandNode {
this.locale = locale; this.locale = locale;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.uuidUtility = uuidUtility; this.uuidUtility = uuidUtility;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setShortHelp(locale.getString(CmdHelpLang.QINSPECT)); setShortHelp(locale.getString(CmdHelpLang.QINSPECT));
setInDepthHelp(locale.getArray(DeepHelpLang.QINSPECT)); setInDepthHelp(locale.getArray(DeepHelpLang.QINSPECT));
@ -130,7 +130,7 @@ public class QInspectCommand extends CommandNode {
sendMessages(sender, container); sendMessages(sender, container);
} catch (DBOpException e) { } catch (DBOpException e) {
sender.sendMessage("§eDatabase exception occurred: " + e.getMessage()); sender.sendMessage("§eDatabase exception occurred: " + e.getMessage());
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
}); });
} }

View File

@ -34,13 +34,13 @@ import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries; import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries;
import com.djrapitops.plan.storage.database.transactions.commands.RegisterWebUserTransaction; import com.djrapitops.plan.storage.database.transactions.commands.RegisterWebUserTransaction;
import com.djrapitops.plan.utilities.PassEncryptUtil; import com.djrapitops.plan.utilities.PassEncryptUtil;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.CommandUtils; import com.djrapitops.plugin.command.CommandUtils;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -70,7 +70,7 @@ public class RegisterCommand extends CommandNode {
private final UUIDUtility uuidUtility; private final UUIDUtility uuidUtility;
private final Addresses addresses; private final Addresses addresses;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public RegisterCommand( public RegisterCommand(
@ -80,7 +80,7 @@ public class RegisterCommand extends CommandNode {
DBSystem dbSystem, DBSystem dbSystem,
UUIDUtility uuidUtility, UUIDUtility uuidUtility,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
// No Permission Requirement // No Permission Requirement
super("register", "", CommandType.ALL); super("register", "", CommandType.ALL);
@ -91,7 +91,7 @@ public class RegisterCommand extends CommandNode {
this.uuidUtility = uuidUtility; this.uuidUtility = uuidUtility;
this.logger = logger; this.logger = logger;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setArguments("<password>", "[name]", "[lvl]"); setArguments("<password>", "[name]", "[lvl]");
setShortHelp(locale.getString(CmdHelpLang.WEB_REGISTER)); setShortHelp(locale.getString(CmdHelpLang.WEB_REGISTER));
@ -128,14 +128,14 @@ public class RegisterCommand extends CommandNode {
registerUsingLegacy(sender, arguments); registerUsingLegacy(sender, arguments);
} }
} catch (PassEncryptUtil.CannotPerformOperationException e) { } catch (PassEncryptUtil.CannotPerformOperationException e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
sender.sendMessage("§cPassword hash error."); sender.sendMessage("§cPassword hash error.");
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new NumberFormatException(args[2]); throw new NumberFormatException(args[2]);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }
@ -205,7 +205,7 @@ public class RegisterCommand extends CommandNode {
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} catch (DBOpException | ExecutionException e) { } catch (DBOpException | ExecutionException e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
}); });
} }

View File

@ -22,11 +22,11 @@ import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.lang.CmdHelpLang; import com.djrapitops.plan.settings.locale.lang.CmdHelpLang;
import com.djrapitops.plan.settings.locale.lang.CommandLang; import com.djrapitops.plan.settings.locale.lang.CommandLang;
import com.djrapitops.plan.settings.locale.lang.DeepHelpLang; import com.djrapitops.plan.settings.locale.lang.DeepHelpLang;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
@ -39,15 +39,15 @@ public class ReloadCommand extends CommandNode {
private final PlanPlugin plugin; private final PlanPlugin plugin;
private final Locale locale; private final Locale locale;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public ReloadCommand(PlanPlugin plugin, Locale locale, ErrorHandler errorHandler) { public ReloadCommand(PlanPlugin plugin, Locale locale, ErrorLogger errorLogger) {
super("reload", Permissions.RELOAD.getPermission(), CommandType.CONSOLE); super("reload", Permissions.RELOAD.getPermission(), CommandType.CONSOLE);
this.plugin = plugin; this.plugin = plugin;
this.locale = locale; this.locale = locale;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setShortHelp(locale.getString(CmdHelpLang.RELOAD)); setShortHelp(locale.getString(CmdHelpLang.RELOAD));
setInDepthHelp(locale.getArray(DeepHelpLang.RELOAD)); setInDepthHelp(locale.getArray(DeepHelpLang.RELOAD));
@ -60,7 +60,7 @@ public class ReloadCommand extends CommandNode {
plugin.reloadPlugin(true); plugin.reloadPlugin(true);
sender.sendMessage(locale.getString(CommandLang.RELOAD_COMPLETE)); sender.sendMessage(locale.getString(CommandLang.RELOAD_COMPLETE));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.CRITICAL, this.getClass(), e); errorLogger.log(L.CRITICAL, this.getClass(), e);
sender.sendMessage(locale.getString(CommandLang.RELOAD_FAILED)); sender.sendMessage(locale.getString(CommandLang.RELOAD_FAILED));
} finally { } finally {
Thread thread = Thread.currentThread(); Thread thread = Thread.currentThread();

View File

@ -27,11 +27,11 @@ import com.djrapitops.plan.settings.locale.lang.ManageLang;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.objects.UserIdentifierQueries; import com.djrapitops.plan.storage.database.queries.objects.UserIdentifierQueries;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import javax.inject.Inject; import javax.inject.Inject;
@ -51,20 +51,20 @@ public class SearchCommand extends CommandNode {
private final Locale locale; private final Locale locale;
private final Processing processing; private final Processing processing;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public SearchCommand( public SearchCommand(
Locale locale, Locale locale,
Processing processing, Processing processing,
DBSystem dbSystem, DBSystem dbSystem,
ErrorHandler errorHandler) { ErrorLogger errorLogger) {
super("search", Permissions.SEARCH.getPermission(), CommandType.PLAYER_OR_ARGS); super("search", Permissions.SEARCH.getPermission(), CommandType.PLAYER_OR_ARGS);
this.locale = locale; this.locale = locale;
this.processing = processing; this.processing = processing;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setArguments("<text>"); setArguments("<text>");
setShortHelp(locale.getString(CmdHelpLang.SEARCH)); setShortHelp(locale.getString(CmdHelpLang.SEARCH));
@ -105,7 +105,7 @@ public class SearchCommand extends CommandNode {
sender.sendMessage(">"); sender.sendMessage(">");
} catch (DBOpException e) { } catch (DBOpException e) {
sender.sendMessage("§cDatabase error occurred: " + e.getMessage()); sender.sendMessage("§cDatabase error occurred: " + e.getMessage());
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
}); });
} }

View File

@ -30,12 +30,12 @@ import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries; import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries;
import com.djrapitops.plan.storage.database.transactions.commands.RemoveWebUserTransaction; import com.djrapitops.plan.storage.database.transactions.commands.RemoveWebUserTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.CommandUtils; import com.djrapitops.plugin.command.CommandUtils;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -56,7 +56,7 @@ public class UnregisterCommand extends CommandNode {
private final Processing processing; private final Processing processing;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final UUIDUtility uuidUtility; private final UUIDUtility uuidUtility;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public UnregisterCommand( public UnregisterCommand(
@ -64,7 +64,7 @@ public class UnregisterCommand extends CommandNode {
Processing processing, Processing processing,
DBSystem dbSystem, DBSystem dbSystem,
UUIDUtility uuidUtility, UUIDUtility uuidUtility,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("unregister", "", CommandType.PLAYER_OR_ARGS); super("unregister", "", CommandType.PLAYER_OR_ARGS);
@ -72,7 +72,7 @@ public class UnregisterCommand extends CommandNode {
this.processing = processing; this.processing = processing;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.uuidUtility = uuidUtility; this.uuidUtility = uuidUtility;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setShortHelp(locale.getString(CmdHelpLang.WEB_DELETE)); setShortHelp(locale.getString(CmdHelpLang.WEB_DELETE));
setArguments("[username]"); setArguments("[username]");
@ -125,7 +125,7 @@ public class UnregisterCommand extends CommandNode {
.get(); // Wait for completion .get(); // Wait for completion
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS)); sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
} }
}); });

View File

@ -33,11 +33,11 @@ import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.SQLiteDB; import com.djrapitops.plan.storage.database.SQLiteDB;
import com.djrapitops.plan.storage.database.queries.ServerAggregateQueries; import com.djrapitops.plan.storage.database.queries.ServerAggregateQueries;
import com.djrapitops.plan.storage.database.transactions.BackupCopyTransaction; import com.djrapitops.plan.storage.database.transactions.BackupCopyTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import javax.inject.Inject; import javax.inject.Inject;
@ -57,7 +57,7 @@ public class ManageBackupCommand extends CommandNode {
private final Processing processing; private final Processing processing;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final SQLiteDB.Factory sqliteFactory; private final SQLiteDB.Factory sqliteFactory;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final Formatter<Long> iso8601LongFormatter; private final Formatter<Long> iso8601LongFormatter;
@ -68,7 +68,7 @@ public class ManageBackupCommand extends CommandNode {
DBSystem dbSystem, DBSystem dbSystem,
SQLiteDB.Factory sqliteFactory, SQLiteDB.Factory sqliteFactory,
Formatters formatters, Formatters formatters,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("backup", Permissions.MANAGE.getPermission(), CommandType.CONSOLE); super("backup", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
@ -76,7 +76,7 @@ public class ManageBackupCommand extends CommandNode {
this.processing = processing; this.processing = processing;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.sqliteFactory = sqliteFactory; this.sqliteFactory = sqliteFactory;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
this.iso8601LongFormatter = formatters.iso8601NoClockLong(); this.iso8601LongFormatter = formatters.iso8601NoClockLong();
@ -118,7 +118,7 @@ public class ManageBackupCommand extends CommandNode {
createNewBackup(args[0], database); createNewBackup(args[0], database);
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS)); sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, ManageBackupCommand.class, e); errorLogger.log(L.ERROR, ManageBackupCommand.class, e);
sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
} }
}); });
@ -143,7 +143,7 @@ public class ManageBackupCommand extends CommandNode {
backupDB.init(); backupDB.init();
backupDB.executeTransaction(new BackupCopyTransaction(copyFromDB, backupDB)).get(); backupDB.executeTransaction(new BackupCopyTransaction(copyFromDB, backupDB)).get();
} catch (DBOpException | ExecutionException e) { } catch (DBOpException | ExecutionException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} catch (InterruptedException e) { } catch (InterruptedException e) {
backupDB.close(); backupDB.close();
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();

View File

@ -31,11 +31,11 @@ import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.DBType; import com.djrapitops.plan.storage.database.DBType;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction; import com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import javax.inject.Inject; import javax.inject.Inject;
@ -56,7 +56,7 @@ public class ManageClearCommand extends CommandNode {
private final Processing processing; private final Processing processing;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final QuerySvc queryService; private final QuerySvc queryService;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public ManageClearCommand( public ManageClearCommand(
@ -65,7 +65,7 @@ public class ManageClearCommand extends CommandNode {
Processing processing, Processing processing,
DBSystem dbSystem, DBSystem dbSystem,
QuerySvc queryService, QuerySvc queryService,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("clear", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); super("clear", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
this.plugin = plugin; this.plugin = plugin;
@ -74,7 +74,7 @@ public class ManageClearCommand extends CommandNode {
this.processing = processing; this.processing = processing;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.queryService = queryService; this.queryService = queryService;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setArguments("<DB>", "[-a]"); setArguments("<DB>", "[-a]");
setShortHelp(locale.getString(CmdHelpLang.MANAGE_CLEAR)); setShortHelp(locale.getString(CmdHelpLang.MANAGE_CLEAR));
@ -119,7 +119,7 @@ public class ManageClearCommand extends CommandNode {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} catch (DBOpException | ExecutionException e) { } catch (DBOpException | ExecutionException e) {
sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
}); });
} }
@ -128,7 +128,7 @@ public class ManageClearCommand extends CommandNode {
try { try {
plugin.reloadPlugin(true); plugin.reloadPlugin(true);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.CRITICAL, this.getClass(), e); errorLogger.log(L.CRITICAL, this.getClass(), e);
sender.sendMessage(locale.getString(CommandLang.RELOAD_FAILED)); sender.sendMessage(locale.getString(CommandLang.RELOAD_FAILED));
} }
sender.sendMessage(locale.getString(CommandLang.RELOAD_COMPLETE)); sender.sendMessage(locale.getString(CommandLang.RELOAD_COMPLETE));

View File

@ -27,11 +27,11 @@ import com.djrapitops.plan.settings.locale.lang.ManageLang;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.DBType; import com.djrapitops.plan.storage.database.DBType;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import javax.inject.Inject; import javax.inject.Inject;
@ -50,17 +50,17 @@ public class ManageHotSwapCommand extends CommandNode {
private final Locale locale; private final Locale locale;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final PlanConfig config; private final PlanConfig config;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public ManageHotSwapCommand(PlanPlugin plugin, Locale locale, DBSystem dbSystem, PlanConfig config, ErrorHandler errorHandler) { public ManageHotSwapCommand(PlanPlugin plugin, Locale locale, DBSystem dbSystem, PlanConfig config, ErrorLogger errorLogger) {
super("hotswap", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); super("hotswap", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
this.plugin = plugin; this.plugin = plugin;
this.locale = locale; this.locale = locale;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.config = config; this.config = config;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setArguments("<DB>"); setArguments("<DB>");
setShortHelp(locale.getString(CmdHelpLang.MANAGE_HOTSWAP)); setShortHelp(locale.getString(CmdHelpLang.MANAGE_HOTSWAP));
@ -88,7 +88,7 @@ public class ManageHotSwapCommand extends CommandNode {
return; return;
} }
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
return; return;
} }
@ -97,7 +97,7 @@ public class ManageHotSwapCommand extends CommandNode {
config.set(DatabaseSettings.TYPE, dbName); config.set(DatabaseSettings.TYPE, dbName);
config.save(); config.save();
} catch (IOException e) { } catch (IOException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
return; return;
} }
plugin.reloadPlugin(true); plugin.reloadPlugin(true);

View File

@ -27,11 +27,11 @@ import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.DBType; import com.djrapitops.plan.storage.database.DBType;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.transactions.BackupCopyTransaction; import com.djrapitops.plan.storage.database.transactions.BackupCopyTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import javax.inject.Inject; import javax.inject.Inject;
@ -51,21 +51,21 @@ public class ManageMoveCommand extends CommandNode {
private final Locale locale; private final Locale locale;
private final Processing processing; private final Processing processing;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public ManageMoveCommand( public ManageMoveCommand(
Locale locale, Locale locale,
Processing processing, Processing processing,
DBSystem dbSystem, DBSystem dbSystem,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("move", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); super("move", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
this.locale = locale; this.locale = locale;
this.processing = processing; this.processing = processing;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setArguments("<fromDB>", "<toDB>", "[-a]"); setArguments("<fromDB>", "<toDB>", "[-a]");
setShortHelp(locale.getString(CmdHelpLang.MANAGE_MOVE)); setShortHelp(locale.getString(CmdHelpLang.MANAGE_MOVE));
@ -129,7 +129,7 @@ public class ManageMoveCommand extends CommandNode {
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
} }
}); });

View File

@ -31,11 +31,11 @@ import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.PlayerFetchQueries; import com.djrapitops.plan.storage.database.queries.PlayerFetchQueries;
import com.djrapitops.plan.storage.database.transactions.commands.RemovePlayerTransaction; import com.djrapitops.plan.storage.database.transactions.commands.RemovePlayerTransaction;
import com.djrapitops.plan.utilities.MiscUtils; import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import javax.inject.Inject; import javax.inject.Inject;
@ -58,7 +58,7 @@ public class ManageRemoveCommand extends CommandNode {
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final QuerySvc queryService; private final QuerySvc queryService;
private final UUIDUtility uuidUtility; private final UUIDUtility uuidUtility;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public ManageRemoveCommand( public ManageRemoveCommand(
@ -67,7 +67,7 @@ public class ManageRemoveCommand extends CommandNode {
DBSystem dbSystem, DBSystem dbSystem,
QuerySvc queryService, QuerySvc queryService,
UUIDUtility uuidUtility, UUIDUtility uuidUtility,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("remove|delete", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); super("remove|delete", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
@ -76,7 +76,7 @@ public class ManageRemoveCommand extends CommandNode {
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.queryService = queryService; this.queryService = queryService;
this.uuidUtility = uuidUtility; this.uuidUtility = uuidUtility;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setArguments("<player>", "[-a]"); setArguments("<player>", "[-a]");
setShortHelp(locale.getString(CmdHelpLang.MANAGE_REMOVE)); setShortHelp(locale.getString(CmdHelpLang.MANAGE_REMOVE));
@ -131,7 +131,7 @@ public class ManageRemoveCommand extends CommandNode {
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} catch (DBOpException | ExecutionException e) { } catch (DBOpException | ExecutionException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
} }
}); });

View File

@ -29,11 +29,11 @@ import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.SQLiteDB; import com.djrapitops.plan.storage.database.SQLiteDB;
import com.djrapitops.plan.storage.database.transactions.BackupCopyTransaction; import com.djrapitops.plan.storage.database.transactions.BackupCopyTransaction;
import com.djrapitops.plan.storage.file.PlanFiles; import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import javax.inject.Inject; import javax.inject.Inject;
@ -51,7 +51,7 @@ public class ManageRestoreCommand extends CommandNode {
private final Locale locale; private final Locale locale;
private final Processing processing; private final Processing processing;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final SQLiteDB.Factory sqliteFactory; private final SQLiteDB.Factory sqliteFactory;
private final PlanFiles files; private final PlanFiles files;
@ -62,7 +62,7 @@ public class ManageRestoreCommand extends CommandNode {
DBSystem dbSystem, DBSystem dbSystem,
SQLiteDB.Factory sqliteFactory, SQLiteDB.Factory sqliteFactory,
PlanFiles files, PlanFiles files,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("restore", Permissions.MANAGE.getPermission(), CommandType.CONSOLE); super("restore", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
@ -71,7 +71,7 @@ public class ManageRestoreCommand extends CommandNode {
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.sqliteFactory = sqliteFactory; this.sqliteFactory = sqliteFactory;
this.files = files; this.files = files;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setArguments("<Filename.db>", "<dbTo>", "[-a]"); setArguments("<Filename.db>", "<dbTo>", "[-a]");
setShortHelp(locale.getString(CmdHelpLang.MANAGE_RESTORE)); setShortHelp(locale.getString(CmdHelpLang.MANAGE_RESTORE));
@ -135,7 +135,7 @@ public class ManageRestoreCommand extends CommandNode {
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
} }
}); });

View File

@ -30,11 +30,11 @@ import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
import com.djrapitops.plan.storage.database.transactions.commands.SetServerAsUninstalledTransaction; import com.djrapitops.plan.storage.database.transactions.commands.SetServerAsUninstalledTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -52,7 +52,7 @@ public class ManageUninstalledCommand extends CommandNode {
private final Locale locale; private final Locale locale;
private final Processing processing; private final Processing processing;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
@Inject @Inject
@ -61,7 +61,7 @@ public class ManageUninstalledCommand extends CommandNode {
Processing processing, Processing processing,
DBSystem dbSystem, DBSystem dbSystem,
ServerInfo serverInfo, ServerInfo serverInfo,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("uninstalled", Permissions.MANAGE.getPermission(), CommandType.ALL_WITH_ARGS); super("uninstalled", Permissions.MANAGE.getPermission(), CommandType.ALL_WITH_ARGS);
@ -69,7 +69,7 @@ public class ManageUninstalledCommand extends CommandNode {
this.processing = processing; this.processing = processing;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setShortHelp(locale.getString(CmdHelpLang.MANAGE_UNINSTALLED)); setShortHelp(locale.getString(CmdHelpLang.MANAGE_UNINSTALLED));
setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_UNINSTALLED)); setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_UNINSTALLED));
@ -104,7 +104,7 @@ public class ManageUninstalledCommand extends CommandNode {
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS)); sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
} catch (DBOpException e) { } catch (DBOpException e) {
sender.sendMessage("§cError occurred: " + e.toString()); sender.sendMessage("§cError occurred: " + e.toString());
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
}); });
} }

View File

@ -26,11 +26,11 @@ import com.djrapitops.plan.settings.locale.lang.ManageLang;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries; import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import javax.inject.Inject; import javax.inject.Inject;
@ -49,21 +49,21 @@ public class WebCheckCommand extends CommandNode {
private final Locale locale; private final Locale locale;
private final Processing processing; private final Processing processing;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public WebCheckCommand( public WebCheckCommand(
Locale locale, Locale locale,
Processing processing, Processing processing,
DBSystem dbSystem, DBSystem dbSystem,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("check", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS); super("check", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS);
this.locale = locale; this.locale = locale;
this.processing = processing; this.processing = processing;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setShortHelp(locale.getString(CmdHelpLang.WEB_CHECK)); setShortHelp(locale.getString(CmdHelpLang.WEB_CHECK));
setArguments("<username>"); setArguments("<username>");
@ -93,7 +93,7 @@ public class WebCheckCommand extends CommandNode {
User info = found.get(); User info = found.get();
sender.sendMessage(locale.getString(CommandLang.WEB_USER_LIST, info.getUsername(), info.getPermissionLevel())); sender.sendMessage(locale.getString(CommandLang.WEB_USER_LIST, info.getUsername(), info.getPermissionLevel()));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
} }
}); });

View File

@ -28,11 +28,11 @@ import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries; import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries;
import com.djrapitops.plan.storage.database.transactions.commands.RemoveWebUserTransaction; import com.djrapitops.plan.storage.database.transactions.commands.RemoveWebUserTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import javax.inject.Inject; import javax.inject.Inject;
@ -51,21 +51,21 @@ public class WebDeleteCommand extends CommandNode {
private final Locale locale; private final Locale locale;
private final Processing processing; private final Processing processing;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public WebDeleteCommand( public WebDeleteCommand(
Locale locale, Locale locale,
Processing processing, Processing processing,
DBSystem dbSystem, DBSystem dbSystem,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("delete|remove", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS); super("delete|remove", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS);
this.locale = locale; this.locale = locale;
this.processing = processing; this.processing = processing;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setShortHelp(locale.getString(CmdHelpLang.WEB_DELETE)); setShortHelp(locale.getString(CmdHelpLang.WEB_DELETE));
setArguments("<username>"); setArguments("<username>");
@ -97,7 +97,7 @@ public class WebDeleteCommand extends CommandNode {
.get(); // Wait for completion .get(); // Wait for completion
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS)); sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
} }
}); });

View File

@ -26,11 +26,11 @@ import com.djrapitops.plan.settings.locale.lang.ManageLang;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries; import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.Sender; import com.djrapitops.plugin.command.Sender;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -47,21 +47,21 @@ public class WebListUsersCommand extends CommandNode {
private final Locale locale; private final Locale locale;
private final Processing processing; private final Processing processing;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public WebListUsersCommand( public WebListUsersCommand(
Locale locale, Locale locale,
Processing processing, Processing processing,
DBSystem dbSystem, DBSystem dbSystem,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super("list", Permissions.MANAGE_WEB.getPerm(), CommandType.CONSOLE); super("list", Permissions.MANAGE_WEB.getPerm(), CommandType.CONSOLE);
this.locale = locale; this.locale = locale;
this.processing = processing; this.processing = processing;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
setShortHelp(locale.getString(CmdHelpLang.WEB_LIST)); setShortHelp(locale.getString(CmdHelpLang.WEB_LIST));
} }
@ -83,7 +83,7 @@ public class WebListUsersCommand extends CommandNode {
} }
sender.sendMessage(">"); sender.sendMessage(">");
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
} }
}); });

View File

@ -22,9 +22,9 @@ import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.ExportSettings; import com.djrapitops.plan.settings.config.paths.ExportSettings;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -46,7 +46,7 @@ public class ExportScheduler {
private final Exporter exporter; private final Exporter exporter;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public ExportScheduler( public ExportScheduler(
@ -55,14 +55,14 @@ public class ExportScheduler {
TaskSystem taskSystem, TaskSystem taskSystem,
Exporter exporter, Exporter exporter,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.config = config; this.config = config;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.taskSystem = taskSystem; this.taskSystem = taskSystem;
this.exporter = exporter; this.exporter = exporter;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
public void scheduleExport() { public void scheduleExport() {
@ -73,7 +73,7 @@ public class ExportScheduler {
private void schedulePlayersPageExport() { private void schedulePlayersPageExport() {
long period = TimeAmount.toTicks(config.get(ExportSettings.EXPORT_PERIOD), TimeUnit.MILLISECONDS); long period = TimeAmount.toTicks(config.get(ExportSettings.EXPORT_PERIOD), TimeUnit.MILLISECONDS);
taskSystem.registerTask("Players page export", taskSystem.registerTask("Players page export",
new ExportTask(exporter, Exporter::exportPlayersPage, logger, errorHandler) new ExportTask(exporter, Exporter::exportPlayersPage, logger, errorLogger)
).runTaskTimerAsynchronously(0L, period); ).runTaskTimerAsynchronously(0L, period);
} }
@ -89,7 +89,7 @@ public class ExportScheduler {
Optional<Server> proxy = servers.stream().filter(Server::isProxy).findFirst(); Optional<Server> proxy = servers.stream().filter(Server::isProxy).findFirst();
proxy.ifPresent(mainServer -> taskSystem.registerTask("Network export", proxy.ifPresent(mainServer -> taskSystem.registerTask("Network export",
new ExportTask(exporter, exporter -> exporter.exportServerPage(mainServer), logger, errorHandler)) new ExportTask(exporter, exporter -> exporter.exportServerPage(mainServer), logger, errorLogger))
.runTaskTimerAsynchronously(0L, period) .runTaskTimerAsynchronously(0L, period)
); );
@ -99,7 +99,7 @@ public class ExportScheduler {
new ExportTask(exporter, same -> { new ExportTask(exporter, same -> {
same.exportServerPage(server); same.exportServerPage(server);
same.exportServerJSON(server); same.exportServerJSON(server);
}, logger, errorHandler)) }, logger, errorLogger))
.runTaskTimerAsynchronously(offset * offsetMultiplier, period); .runTaskTimerAsynchronously(offset * offsetMultiplier, period);
offsetMultiplier++; offsetMultiplier++;
} }

View File

@ -19,9 +19,9 @@ package com.djrapitops.plan.delivery.export;
import com.djrapitops.plan.exceptions.ExportException; import com.djrapitops.plan.exceptions.ExportException;
import com.djrapitops.plan.exceptions.database.DBOpException; import com.djrapitops.plan.exceptions.database.DBOpException;
import com.djrapitops.plan.utilities.java.ThrowingConsumer; import com.djrapitops.plan.utilities.java.ThrowingConsumer;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.AbsRunnable;
public class ExportTask extends AbsRunnable { public class ExportTask extends AbsRunnable {
@ -29,18 +29,18 @@ public class ExportTask extends AbsRunnable {
private final Exporter exporter; private final Exporter exporter;
private final ThrowingConsumer<Exporter, ExportException> exportAction; private final ThrowingConsumer<Exporter, ExportException> exportAction;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
public ExportTask( public ExportTask(
Exporter exporter, Exporter exporter,
ThrowingConsumer<Exporter, ExportException> exportAction, ThrowingConsumer<Exporter, ExportException> exportAction,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.exporter = exporter; this.exporter = exporter;
this.exportAction = exportAction; this.exportAction = exportAction;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Override @Override
@ -48,12 +48,12 @@ public class ExportTask extends AbsRunnable {
try { try {
exportAction.accept(exporter); exportAction.accept(exporter);
} catch (ExportException e) { } catch (ExportException e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} catch (DBOpException dbException) { } catch (DBOpException dbException) {
handleDBException(dbException); handleDBException(dbException);
} catch (Exception | NoClassDefFoundError | NoSuchMethodError | NoSuchFieldError e) { } catch (Exception | NoClassDefFoundError | NoSuchMethodError | NoSuchFieldError e) {
logger.error("Export Task Disabled due to error, reload Plan to re-enable."); logger.error("Export Task Disabled due to error, reload Plan to re-enable.");
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
cancel(); cancel();
} }
} }
@ -63,7 +63,7 @@ public class ExportTask extends AbsRunnable {
if (dbException.getMessage().contains("closed")) { if (dbException.getMessage().contains("closed")) {
logger.warn("(Error was caused by database closing, so this error can possibly be ignored.)"); logger.warn("(Error was caused by database closing, so this error can possibly be ignored.)");
} else { } else {
errorHandler.log(L.ERROR, this.getClass(), dbException); errorLogger.log(L.ERROR, this.getClass(), dbException);
} }
cancel(); cancel();
} }

View File

@ -30,21 +30,16 @@ import com.djrapitops.plan.gathering.domain.Session;
import com.djrapitops.plan.identification.ServerInfo; import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.identification.properties.ServerProperties; import com.djrapitops.plan.identification.properties.ServerProperties;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.file.FileResource;
import com.djrapitops.plan.storage.file.ResourceCache; import com.djrapitops.plan.storage.file.ResourceCache;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plan.version.VersionChecker; import com.djrapitops.plan.version.VersionChecker;
import com.djrapitops.plugin.benchmarking.Benchmark; import com.djrapitops.plugin.benchmarking.Benchmark;
import com.djrapitops.plugin.benchmarking.Timings; import com.djrapitops.plugin.benchmarking.Timings;
import com.djrapitops.plugin.logging.FolderTimeStampFileLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.debug.CombineDebugLogger; import com.djrapitops.plugin.logging.debug.CombineDebugLogger;
import com.djrapitops.plugin.logging.debug.DebugLogger; import com.djrapitops.plugin.logging.debug.DebugLogger;
import com.djrapitops.plugin.logging.debug.MemoryDebugLogger; import com.djrapitops.plugin.logging.debug.MemoryDebugLogger;
import com.djrapitops.plugin.logging.error.DefaultErrorHandler;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.logging.error.FolderTimeStampErrorFileLogger;
import java.io.IOException;
import java.util.*; import java.util.*;
/** /**
@ -60,7 +55,7 @@ public class DebugPage implements Page {
private final VersionChecker versionChecker; private final VersionChecker versionChecker;
private final CombineDebugLogger debugLogger; private final CombineDebugLogger debugLogger;
private final Timings timings; private final Timings timings;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final Formatter<Long> yearFormatter; private final Formatter<Long> yearFormatter;
@ -73,7 +68,7 @@ public class DebugPage implements Page {
VersionChecker versionChecker, VersionChecker versionChecker,
DebugLogger debugLogger, DebugLogger debugLogger,
Timings timings, Timings timings,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.template = htmlTemplate; this.template = htmlTemplate;
@ -82,7 +77,7 @@ public class DebugPage implements Page {
this.versionChecker = versionChecker; this.versionChecker = versionChecker;
this.debugLogger = (CombineDebugLogger) debugLogger; this.debugLogger = (CombineDebugLogger) debugLogger;
this.timings = timings; this.timings = timings;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
this.yearFormatter = formatters.yearLong(); this.yearFormatter = formatters.yearLong();
} }
@ -140,7 +135,7 @@ public class DebugPage implements Page {
} }
content.append("</pre>"); content.append("</pre>");
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }
@ -156,7 +151,7 @@ public class DebugPage implements Page {
} }
content.append("</pre>"); content.append("</pre>");
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }
@ -177,7 +172,7 @@ public class DebugPage implements Page {
} }
content.append("</pre>"); content.append("</pre>");
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }
@ -256,51 +251,10 @@ public class DebugPage implements Page {
private void appendLoggedErrors(StringBuilder content) { private void appendLoggedErrors(StringBuilder content) {
content.append("<pre>### Logged Errors<br>"); content.append("<pre>### Logged Errors<br>");
content.append("Using incompatible ErrorHandler");
if (errorHandler instanceof DefaultErrorHandler) {
appendErrorLines(content, (DefaultErrorHandler) errorHandler);
} else {
content.append("Using incompatible ErrorHandler");
}
content.append("</pre>"); content.append("</pre>");
} }
private void appendErrorLines(StringBuilder content, DefaultErrorHandler errorHandler) {
List<String> lines = errorHandler.getErrorHandler(FolderTimeStampErrorFileLogger.class)
.flatMap(FolderTimeStampFileLogger::getCurrentFile)
.map(file -> {
try {
return FileResource.lines(file);
} catch (IOException e) {
errorHandler.log(L.WARN, this.getClass(), e);
return new ArrayList<String>();
}
}).orElse(new ArrayList<>());
SortedMap<String, List<String>> errors = FolderTimeStampErrorFileLogger.splitByError(lines);
if (!errors.isEmpty()) {
List<String> errorLines = new ArrayList<>();
for (Map.Entry<String, List<String>> entry : errors.entrySet()) {
StringBuilder errorLineBuilder = new StringBuilder();
for (String line : entry.getValue()) {
errorLineBuilder.append(line).append("<br>");
}
String error = errorLineBuilder.toString();
if (!errorLines.contains(error)) {
errorLines.add(error);
}
}
for (String error : errorLines) {
content.append("</pre><pre>&#96;&#96;&#96;<br>")
.append(error)
.append("&#96;&#96;&#96;");
}
} else {
content.append("**No Errors logged.**<br>");
}
}
private void appendDebugLog(StringBuilder content) { private void appendDebugLog(StringBuilder content) {
Optional<MemoryDebugLogger> memoryDebugLogger = this.debugLogger.getDebugLogger(MemoryDebugLogger.class); Optional<MemoryDebugLogger> memoryDebugLogger = this.debugLogger.getDebugLogger(MemoryDebugLogger.class);
Map<String, List<String>> channels = memoryDebugLogger.map(MemoryDebugLogger::getChannels).orElse(new HashMap<>()); Map<String, List<String>> channels = memoryDebugLogger.map(MemoryDebugLogger::getChannels).orElse(new HashMap<>());

View File

@ -33,10 +33,10 @@ import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries; import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries;
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
import com.djrapitops.plan.storage.file.PlanFiles; import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plan.version.VersionChecker; import com.djrapitops.plan.version.VersionChecker;
import com.djrapitops.plugin.benchmarking.Timings; import com.djrapitops.plugin.benchmarking.Timings;
import com.djrapitops.plugin.logging.debug.DebugLogger; import com.djrapitops.plugin.logging.debug.DebugLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import dagger.Lazy; import dagger.Lazy;
import javax.inject.Inject; import javax.inject.Inject;
@ -63,7 +63,7 @@ public class PageFactory {
private final Lazy<Formatters> formatters; private final Lazy<Formatters> formatters;
private final Lazy<DebugLogger> debugLogger; private final Lazy<DebugLogger> debugLogger;
private final Lazy<Timings> timings; private final Lazy<Timings> timings;
private final Lazy<ErrorHandler> errorHandler; private final Lazy<ErrorLogger> errorLogger;
@Inject @Inject
public PageFactory( public PageFactory(
@ -77,7 +77,7 @@ public class PageFactory {
Lazy<Formatters> formatters, Lazy<Formatters> formatters,
Lazy<DebugLogger> debugLogger, Lazy<DebugLogger> debugLogger,
Lazy<Timings> timings, Lazy<Timings> timings,
Lazy<ErrorHandler> errorHandler Lazy<ErrorLogger> errorLogger
) { ) {
this.versionChecker = versionChecker; this.versionChecker = versionChecker;
this.files = files; this.files = files;
@ -89,14 +89,14 @@ public class PageFactory {
this.formatters = formatters; this.formatters = formatters;
this.debugLogger = debugLogger; this.debugLogger = debugLogger;
this.timings = timings; this.timings = timings;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
public DebugPage debugPage() throws IOException { public DebugPage debugPage() throws IOException {
return new DebugPage( return new DebugPage(
getResource("error.html"), getResource("error.html"),
dbSystem.get().getDatabase(), serverInfo.get(), formatters.get(), versionChecker.get(), dbSystem.get().getDatabase(), serverInfo.get(), formatters.get(), versionChecker.get(),
debugLogger.get(), timings.get(), errorHandler.get() debugLogger.get(), timings.get(), errorLogger.get()
); );
} }

View File

@ -23,9 +23,9 @@ import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.lang.PluginLang; import com.djrapitops.plan.settings.locale.lang.PluginLang;
import com.djrapitops.plan.storage.file.PlanFiles; import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.storage.file.Resource; import com.djrapitops.plan.storage.file.Resource;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.TextStringBuilder; import org.apache.commons.text.TextStringBuilder;
@ -53,7 +53,7 @@ public class ResourceSvc implements ResourceService {
private final ResourceSettings resourceSettings; private final ResourceSettings resourceSettings;
private final Locale locale; private final Locale locale;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public ResourceSvc( public ResourceSvc(
@ -61,13 +61,13 @@ public class ResourceSvc implements ResourceService {
PlanConfig config, PlanConfig config,
Locale locale, Locale locale,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.files = files; this.files = files;
this.resourceSettings = config.getResourceSettings(); this.resourceSettings = config.getResourceSettings();
this.locale = locale; this.locale = locale;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
this.snippets = new HashSet<>(); this.snippets = new HashSet<>();
} }
@ -145,7 +145,7 @@ public class ResourceSvc implements ResourceService {
return getOrWriteCustomized(fileName, source); return getOrWriteCustomized(fileName, source);
} }
} catch (IOException e) { } catch (IOException e) {
errorHandler.log(L.WARN, getClass(), e.getCause()); errorLogger.log(L.WARN, getClass(), e.getCause());
} }
// Return original by default // Return original by default
return source.get(); return source.get();

View File

@ -19,9 +19,9 @@ package com.djrapitops.plan.delivery.webserver;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.PluginSettings; import com.djrapitops.plan.settings.config.paths.PluginSettings;
import com.djrapitops.plan.settings.config.paths.WebserverSettings; import com.djrapitops.plan.settings.config.paths.WebserverSettings;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import java.io.IOException; import java.io.IOException;
@ -36,20 +36,20 @@ public class NonProxyWebserverDisableChecker implements Runnable {
private final Addresses addresses; private final Addresses addresses;
private final WebServerSystem webServerSystem; private final WebServerSystem webServerSystem;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
public NonProxyWebserverDisableChecker( public NonProxyWebserverDisableChecker(
PlanConfig config, PlanConfig config,
Addresses addresses, Addresses addresses,
WebServerSystem webServerSystem, WebServerSystem webServerSystem,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.config = config; this.config = config;
this.addresses = addresses; this.addresses = addresses;
this.webServerSystem = webServerSystem; this.webServerSystem = webServerSystem;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Override @Override
@ -75,7 +75,7 @@ public class NonProxyWebserverDisableChecker implements Runnable {
logger.warn("Note: Set '" + WebserverSettings.DISABLED.getPath() + "' to true"); logger.warn("Note: Set '" + WebserverSettings.DISABLED.getPath() + "' to true");
} catch (IOException e) { } catch (IOException e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }
} }

View File

@ -31,9 +31,9 @@ import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.PluginSettings; import com.djrapitops.plan.settings.config.paths.PluginSettings;
import com.djrapitops.plan.settings.config.paths.WebserverSettings; import com.djrapitops.plan.settings.config.paths.WebserverSettings;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import com.sun.net.httpserver.Headers; import com.sun.net.httpserver.Headers;
import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpExchange;
@ -62,7 +62,7 @@ public class RequestHandler implements HttpHandler {
private final ResponseResolver responseResolver; private final ResponseResolver responseResolver;
private final ResponseFactory responseFactory; private final ResponseFactory responseFactory;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final PassBruteForceGuard bruteForceGuard; private final PassBruteForceGuard bruteForceGuard;
@ -74,7 +74,7 @@ public class RequestHandler implements HttpHandler {
ResponseResolver responseResolver, ResponseResolver responseResolver,
ResponseFactory responseFactory, ResponseFactory responseFactory,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.config = config; this.config = config;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
@ -82,7 +82,7 @@ public class RequestHandler implements HttpHandler {
this.responseResolver = responseResolver; this.responseResolver = responseResolver;
this.responseFactory = responseFactory; this.responseFactory = responseFactory;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
bruteForceGuard = new PassBruteForceGuard(); bruteForceGuard = new PassBruteForceGuard();
} }
@ -99,7 +99,7 @@ public class RequestHandler implements HttpHandler {
} catch (Exception e) { } catch (Exception e) {
if (config.isTrue(PluginSettings.DEV_MODE)) { if (config.isTrue(PluginSettings.DEV_MODE)) {
logger.warn("THIS ERROR IS ONLY LOGGED IN DEV MODE:"); logger.warn("THIS ERROR IS ONLY LOGGED IN DEV MODE:");
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} finally { } finally {
exchange.close(); exchange.close();

View File

@ -31,8 +31,8 @@ import com.djrapitops.plan.delivery.webserver.resolver.auth.*;
import com.djrapitops.plan.delivery.webserver.resolver.json.RootJSONResolver; import com.djrapitops.plan.delivery.webserver.resolver.json.RootJSONResolver;
import com.djrapitops.plan.exceptions.WebUserAuthException; import com.djrapitops.plan.exceptions.WebUserAuthException;
import com.djrapitops.plan.exceptions.connection.ForbiddenException; import com.djrapitops.plan.exceptions.connection.ForbiddenException;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import dagger.Lazy; import dagger.Lazy;
import javax.inject.Inject; import javax.inject.Inject;
@ -59,12 +59,12 @@ public class ResponseResolver {
private final RootPageResolver rootPageResolver; private final RootPageResolver rootPageResolver;
private final RootJSONResolver rootJSONResolver; private final RootJSONResolver rootJSONResolver;
private final StaticResourceResolver staticResourceResolver; private final StaticResourceResolver staticResourceResolver;
private LoginPageResolver loginPageResolver; private final LoginPageResolver loginPageResolver;
private RegisterPageResolver registerPageResolver; private final RegisterPageResolver registerPageResolver;
private LoginResolver loginResolver; private final LoginResolver loginResolver;
private LogoutResolver logoutResolver; private final LogoutResolver logoutResolver;
private RegisterResolver registerResolver; private final RegisterResolver registerResolver;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final ResolverService resolverService; private final ResolverService resolverService;
private final ResponseFactory responseFactory; private final ResponseFactory responseFactory;
@ -90,7 +90,7 @@ public class ResponseResolver {
LogoutResolver logoutResolver, LogoutResolver logoutResolver,
RegisterResolver registerResolver, RegisterResolver registerResolver,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.resolverService = resolverService; this.resolverService = resolverService;
this.responseFactory = responseFactory; this.responseFactory = responseFactory;
@ -107,7 +107,7 @@ public class ResponseResolver {
this.loginResolver = loginResolver; this.loginResolver = loginResolver;
this.logoutResolver = logoutResolver; this.logoutResolver = logoutResolver;
this.registerResolver = registerResolver; this.registerResolver = registerResolver;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
public void registerPages() { public void registerPages() {
@ -143,7 +143,7 @@ public class ResponseResolver {
} catch (WebUserAuthException e) { } catch (WebUserAuthException e) {
throw e; // Pass along throw e; // Pass along
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
return responseFactory.internalErrorResponse(e, request.getPath().asString()); return responseFactory.internalErrorResponse(e, request.getPath().asString());
} }
} }

View File

@ -23,9 +23,9 @@ import com.djrapitops.plan.settings.config.paths.WebserverSettings;
import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.lang.PluginLang; import com.djrapitops.plan.settings.locale.lang.PluginLang;
import com.djrapitops.plan.storage.file.PlanFiles; import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.sun.net.httpserver.HttpServer; import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator; import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsParameters; import com.sun.net.httpserver.HttpsParameters;
@ -59,7 +59,7 @@ public class WebServer implements SubSystem {
private final RequestHandler requestHandler; private final RequestHandler requestHandler;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private int port; private int port;
private boolean enabled = false; private boolean enabled = false;
@ -74,7 +74,7 @@ public class WebServer implements SubSystem {
PlanConfig config, PlanConfig config,
Addresses addresses, Addresses addresses,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler, ErrorLogger errorLogger,
RequestHandler requestHandler RequestHandler requestHandler
) { ) {
this.locale = locale; this.locale = locale;
@ -85,7 +85,7 @@ public class WebServer implements SubSystem {
this.requestHandler = requestHandler; this.requestHandler = requestHandler;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Override @Override
@ -145,7 +145,7 @@ public class WebServer implements SubSystem {
.namingPattern("Plan WebServer Thread-%d") .namingPattern("Plan WebServer Thread-%d")
.uncaughtExceptionHandler((thread, throwable) -> { .uncaughtExceptionHandler((thread, throwable) -> {
if (config.isTrue(PluginSettings.DEV_MODE)) { if (config.isTrue(PluginSettings.DEV_MODE)) {
errorHandler.log(L.WARN, WebServer.class, throwable); errorLogger.log(L.WARN, WebServer.class, throwable);
} }
}).build() }).build()
); );
@ -165,7 +165,7 @@ public class WebServer implements SubSystem {
logger.error("Webserver failed to bind port: " + failedToBind.toString()); logger.error("Webserver failed to bind port: " + failedToBind.toString());
enabled = false; enabled = false;
} catch (IllegalArgumentException | IllegalStateException | IOException e) { } catch (IllegalArgumentException | IllegalStateException | IOException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
enabled = false; enabled = false;
} }
} }
@ -183,7 +183,7 @@ public class WebServer implements SubSystem {
} }
} catch (InvalidPathException e) { } catch (InvalidPathException e) {
logger.error("WebServer: Could not find Keystore: " + e.getMessage()); logger.error("WebServer: Could not find Keystore: " + e.getMessage());
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
char[] storepass = config.get(WebserverSettings.CERTIFICATE_STOREPASS).toCharArray(); char[] storepass = config.get(WebserverSettings.CERTIFICATE_STOREPASS).toCharArray();
@ -232,7 +232,7 @@ public class WebServer implements SubSystem {
logger.error(e.getMessage()); logger.error(e.getMessage());
} catch (KeyManagementException | NoSuchAlgorithmException e) { } catch (KeyManagementException | NoSuchAlgorithmException e) {
logger.error(locale.getString(PluginLang.WEB_SERVER_FAIL_SSL_CONTEXT)); logger.error(locale.getString(PluginLang.WEB_SERVER_FAIL_SSL_CONTEXT));
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} catch (EOFException e) { } catch (EOFException e) {
logger.error(locale.getString(PluginLang.WEB_SERVER_FAIL_EMPTY_FILE)); logger.error(locale.getString(PluginLang.WEB_SERVER_FAIL_EMPTY_FILE));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
@ -242,10 +242,10 @@ public class WebServer implements SubSystem {
throw e; // Pass to above error handler throw e; // Pass to above error handler
} catch (IOException e) { } catch (IOException e) {
logger.error("WebServer: " + e); logger.error("WebServer: " + e);
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} catch (KeyStoreException | CertificateException | UnrecoverableKeyException e) { } catch (KeyStoreException | CertificateException | UnrecoverableKeyException e) {
logger.error(locale.getString(PluginLang.WEB_SERVER_FAIL_STORE_LOAD)); logger.error(locale.getString(PluginLang.WEB_SERVER_FAIL_STORE_LOAD));
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
return startSuccessful; return startSuccessful;
} }

View File

@ -29,9 +29,9 @@ import com.djrapitops.plan.processing.Processing;
import com.djrapitops.plan.settings.config.ExtensionSettings; import com.djrapitops.plan.settings.config.ExtensionSettings;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -55,7 +55,7 @@ public class ExtensionSvc implements ExtensionService {
private final Processing processing; private final Processing processing;
private final ExtensionRegister extensionRegister; private final ExtensionRegister extensionRegister;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final Map<String, ProviderValueGatherer> extensionGatherers; private final Map<String, ProviderValueGatherer> extensionGatherers;
@ -67,7 +67,7 @@ public class ExtensionSvc implements ExtensionService {
Processing processing, Processing processing,
ExtensionRegister extensionRegister, ExtensionRegister extensionRegister,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.config = config; this.config = config;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
@ -75,7 +75,7 @@ public class ExtensionSvc implements ExtensionService {
this.processing = processing; this.processing = processing;
this.extensionRegister = extensionRegister; this.extensionRegister = extensionRegister;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
extensionGatherers = new HashMap<>(); extensionGatherers = new HashMap<>();
} }
@ -89,7 +89,7 @@ public class ExtensionSvc implements ExtensionService {
extensionRegister.registerBuiltInExtensions(config.getExtensionSettings().getDisabled()); extensionRegister.registerBuiltInExtensions(config.getExtensionSettings().getDisabled());
} catch (IllegalStateException failedToRegisterOne) { } catch (IllegalStateException failedToRegisterOne) {
logger.warn("One or more extensions failed to register, see suppressed exceptions (They can be disabled in Plan config)."); logger.warn("One or more extensions failed to register, see suppressed exceptions (They can be disabled in Plan config).");
errorHandler.log(L.WARN, ExtensionService.class, failedToRegisterOne); errorLogger.log(L.WARN, ExtensionService.class, failedToRegisterOne);
} }
} }
@ -130,7 +130,7 @@ public class ExtensionSvc implements ExtensionService {
try { try {
pluginsConfig.createSection(pluginName); pluginsConfig.createSection(pluginName);
} catch (IOException e) { } catch (IOException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
logger.warn("Could not register DataExtension for " + pluginName + " due to " + e.toString()); logger.warn("Could not register DataExtension for " + pluginName + " due to " + e.toString());
return true; return true;
} }
@ -168,7 +168,7 @@ public class ExtensionSvc implements ExtensionService {
logger.warn("Encountered unexpected error with " + gatherer.getPluginName() + " Extension: " + unexpectedError + logger.warn("Encountered unexpected error with " + gatherer.getPluginName() + " Extension: " + unexpectedError +
" (but failed safely) when updating value for '" + playerName + " (but failed safely) when updating value for '" + playerName +
"', stack trace to follow (please report this):"); "', stack trace to follow (please report this):");
errorHandler.log(L.WARN, gatherer.getClass(), unexpectedError); errorLogger.log(L.WARN, gatherer.getClass(), unexpectedError);
} }
} }
@ -179,7 +179,7 @@ public class ExtensionSvc implements ExtensionService {
" (failed safely) when updating value for '" + playerName + " (failed safely) when updating value for '" + playerName +
"', the method was disabled temporarily (won't be called until next Plan reload)" + "', the method was disabled temporarily (won't be called until next Plan reload)" +
", stack trace to follow (please report this):"); ", stack trace to follow (please report this):");
errorHandler.log(L.WARN, getClass(), cause); errorLogger.log(L.WARN, getClass(), cause);
} }
public void updateServerValues(CallEvents event) { public void updateServerValues(CallEvents event) {
@ -208,7 +208,7 @@ public class ExtensionSvc implements ExtensionService {
} catch (Exception | NoClassDefFoundError | NoSuchFieldError | NoSuchMethodError unexpectedError) { } catch (Exception | NoClassDefFoundError | NoSuchFieldError | NoSuchMethodError unexpectedError) {
logger.warn("Encountered unexpected error with " + gatherer.getPluginName() + " Extension: " + unexpectedError + logger.warn("Encountered unexpected error with " + gatherer.getPluginName() + " Extension: " + unexpectedError +
" (failed safely) when updating value for server, stack trace to follow (please report this):"); " (failed safely) when updating value for server, stack trace to follow (please report this):");
errorHandler.log(L.WARN, gatherer.getClass(), unexpectedError); errorLogger.log(L.WARN, gatherer.getClass(), unexpectedError);
} }
} }
} }

View File

@ -25,9 +25,9 @@ import com.djrapitops.plan.settings.locale.lang.PluginLang;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.transactions.events.ServerShutdownTransaction; import com.djrapitops.plan.storage.database.transactions.events.ServerShutdownTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
@ -44,21 +44,21 @@ public abstract class ServerShutdownSave {
protected final PluginLogger logger; protected final PluginLogger logger;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final Locale locale; private final Locale locale;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private boolean shuttingDown = false;
private boolean shuttingDown = false;
private boolean startedDatabase = false; private boolean startedDatabase = false;
public ServerShutdownSave( public ServerShutdownSave(
Locale locale, Locale locale,
DBSystem dbSystem, DBSystem dbSystem,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.locale = locale; this.locale = locale;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
protected abstract boolean checkServerShuttingDownStatus(); protected abstract boolean checkServerShuttingDownStatus();
@ -90,7 +90,7 @@ public abstract class ServerShutdownSave {
prepareSessionsForStorage(activeSessions, System.currentTimeMillis()); prepareSessionsForStorage(activeSessions, System.currentTimeMillis());
return Optional.of(saveActiveSessions(activeSessions)); return Optional.of(saveActiveSessions(activeSessions));
} catch (DBInitException e) { } catch (DBInitException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
return Optional.empty(); return Optional.empty();
} catch (IllegalStateException ignored) { } catch (IllegalStateException ignored) {
/* Database is not initialized */ /* Database is not initialized */

View File

@ -22,8 +22,8 @@ import com.djrapitops.plan.exceptions.database.DBOpException;
import com.djrapitops.plan.identification.ServerInfo; import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.queries.objects.NicknameQueries; import com.djrapitops.plan.storage.database.queries.objects.NicknameQueries;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -42,7 +42,7 @@ public class NicknameCache implements SubSystem {
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final Map<UUID, String> displayNames; private final Map<UUID, String> displayNames;
@ -50,11 +50,11 @@ public class NicknameCache implements SubSystem {
public NicknameCache( public NicknameCache(
DBSystem dbSystem, DBSystem dbSystem,
ServerInfo serverInfo, ServerInfo serverInfo,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
displayNames = new HashMap<>(); displayNames = new HashMap<>();
} }
@ -99,7 +99,7 @@ public class NicknameCache implements SubSystem {
NicknameQueries.fetchLastSeenNicknameOfPlayer(uuid, serverInfo.getServerUUID()) NicknameQueries.fetchLastSeenNicknameOfPlayer(uuid, serverInfo.getServerUUID())
).map(Nickname::getName); ).map(Nickname::getName);
} catch (DBOpException e) { } catch (DBOpException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
return Optional.empty(); return Optional.empty();
} }

View File

@ -24,8 +24,8 @@ import com.djrapitops.plan.storage.database.transactions.events.TPSStoreTransact
import com.djrapitops.plan.utilities.analysis.Average; import com.djrapitops.plan.utilities.analysis.Average;
import com.djrapitops.plan.utilities.analysis.Maximum; import com.djrapitops.plan.utilities.analysis.Maximum;
import com.djrapitops.plan.utilities.analysis.TimerAverage; import com.djrapitops.plan.utilities.analysis.TimerAverage;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -43,9 +43,9 @@ public class ProxyTPSCounter extends TPSCounter {
private final SystemUsageBuffer systemUsage; private final SystemUsageBuffer systemUsage;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private Maximum.ForInteger playersOnline; private final Maximum.ForInteger playersOnline;
private Average cpu; private final Average cpu;
private TimerAverage ram; private final TimerAverage ram;
@Inject @Inject
public ProxyTPSCounter( public ProxyTPSCounter(
@ -54,9 +54,9 @@ public class ProxyTPSCounter extends TPSCounter {
DBSystem dbSystem, DBSystem dbSystem,
ServerInfo serverInfo, ServerInfo serverInfo,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super(logger, errorHandler); super(logger, errorLogger);
this.serverSensor = serverSensor; this.serverSensor = serverSensor;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;

View File

@ -24,8 +24,8 @@ import com.djrapitops.plan.storage.database.transactions.events.TPSStoreTransact
import com.djrapitops.plan.utilities.analysis.Average; import com.djrapitops.plan.utilities.analysis.Average;
import com.djrapitops.plan.utilities.analysis.Maximum; import com.djrapitops.plan.utilities.analysis.Maximum;
import com.djrapitops.plan.utilities.analysis.TimerAverage; import com.djrapitops.plan.utilities.analysis.TimerAverage;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -47,9 +47,9 @@ public class ServerTPSCounter<W> extends TPSCounter {
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private TPSCalculator indirectTPS; private TPSCalculator indirectTPS;
private TimerAverage directTPS; private TimerAverage directTPS;
private Maximum.ForInteger playersOnline; private final Maximum.ForInteger playersOnline;
private Average cpu; private final Average cpu;
private Average ram; private final Average ram;
@Inject @Inject
public ServerTPSCounter( public ServerTPSCounter(
@ -58,9 +58,9 @@ public class ServerTPSCounter<W> extends TPSCounter {
DBSystem dbSystem, DBSystem dbSystem,
ServerInfo serverInfo, ServerInfo serverInfo,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super(logger, errorHandler); super(logger, errorLogger);
noDirectTPS = !serverSensor.supportsDirectTPS(); noDirectTPS = !serverSensor.supportsDirectTPS();
this.serverSensor = serverSensor; this.serverSensor = serverSensor;

View File

@ -19,9 +19,9 @@ package com.djrapitops.plan.gathering.timed;
import com.djrapitops.plan.gathering.SystemUsage; import com.djrapitops.plan.gathering.SystemUsage;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.DataGatheringSettings; import com.djrapitops.plan.settings.config.paths.DataGatheringSettings;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.AbsRunnable;
import javax.inject.Inject; import javax.inject.Inject;
@ -90,17 +90,17 @@ public class SystemUsageBuffer {
private final PlanConfig config; private final PlanConfig config;
private final SystemUsageBuffer buffer; private final SystemUsageBuffer buffer;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private Boolean gatherDisk = null; private Boolean gatherDisk = null;
private boolean diskErrored = false; private boolean diskErrored = false;
@Inject @Inject
public DiskTask(PlanConfig config, SystemUsageBuffer buffer, PluginLogger logger, ErrorHandler errorHandler) { public DiskTask(PlanConfig config, SystemUsageBuffer buffer, PluginLogger logger, ErrorLogger errorLogger) {
this.config = config; this.config = config;
this.buffer = buffer; this.buffer = buffer;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Override @Override
@ -111,7 +111,7 @@ public class SystemUsageBuffer {
buffer.freeDiskSpace = SystemUsage.getFreeDiskSpace(); buffer.freeDiskSpace = SystemUsage.getFreeDiskSpace();
} catch (SecurityException noPermission) { } catch (SecurityException noPermission) {
if (!diskErrored) { if (!diskErrored) {
errorHandler.log(L.WARN, this.getClass(), noPermission); errorLogger.log(L.WARN, this.getClass(), noPermission);
} }
diskErrored = true; diskErrored = true;
} catch (Exception e) { } catch (Exception e) {

View File

@ -16,9 +16,9 @@
*/ */
package com.djrapitops.plan.gathering.timed; package com.djrapitops.plan.gathering.timed;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.AbsRunnable;
/** /**
@ -29,14 +29,14 @@ import com.djrapitops.plugin.task.AbsRunnable;
public abstract class TPSCounter extends AbsRunnable { public abstract class TPSCounter extends AbsRunnable {
protected final PluginLogger logger; protected final PluginLogger logger;
protected final ErrorHandler errorHandler; protected final ErrorLogger errorLogger;
public TPSCounter( public TPSCounter(
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Override @Override
@ -45,7 +45,7 @@ public abstract class TPSCounter extends AbsRunnable {
pulse(); pulse();
} catch (Exception | NoClassDefFoundError | NoSuchMethodError | NoSuchFieldError e) { } catch (Exception | NoClassDefFoundError | NoSuchMethodError | NoSuchFieldError e) {
logger.error("TPS Count Task Disabled due to error, reload Plan to re-enable."); logger.error("TPS Count Task Disabled due to error, reload Plan to re-enable.");
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
cancel(); cancel();
} }
} }

View File

@ -27,8 +27,8 @@ import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
import com.djrapitops.plan.storage.database.transactions.StoreServerInformationTransaction; import com.djrapitops.plan.storage.database.transactions.StoreServerInformationTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -53,7 +53,7 @@ public class ServerServerInfo extends ServerInfo {
private final Processing processing; private final Processing processing;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final Addresses addresses; private final Addresses addresses;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public ServerServerInfo( public ServerServerInfo(
@ -63,7 +63,7 @@ public class ServerServerInfo extends ServerInfo {
PlanConfig config, PlanConfig config,
DBSystem dbSystem, DBSystem dbSystem,
Addresses addresses, Addresses addresses,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super(serverProperties); super(serverProperties);
this.serverInfoFile = serverInfoFile; this.serverInfoFile = serverInfoFile;
@ -71,7 +71,7 @@ public class ServerServerInfo extends ServerInfo {
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.addresses = addresses; this.addresses = addresses;
this.config = config; this.config = config;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Override @Override
@ -114,7 +114,7 @@ public class ServerServerInfo extends ServerInfo {
try { try {
server = registerServer(serverUUID); server = registerServer(serverUUID);
} catch (ExecutionException | IOException e) { } catch (ExecutionException | IOException e) {
errorHandler.log(L.CRITICAL, this.getClass(), e); errorLogger.log(L.CRITICAL, this.getClass(), e);
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }

View File

@ -19,9 +19,9 @@ package com.djrapitops.plan.identification;
import com.djrapitops.plan.exceptions.database.DBOpException; import com.djrapitops.plan.exceptions.database.DBOpException;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.queries.objects.UserIdentifierQueries; import com.djrapitops.plan.storage.database.queries.objects.UserIdentifierQueries;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.api.utility.UUIDFetcher; import com.djrapitops.plugin.api.utility.UUIDFetcher;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -42,12 +42,12 @@ import java.util.UUID;
public class UUIDUtility { public class UUIDUtility {
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public UUIDUtility(DBSystem dbSystem, ErrorHandler errorHandler) { public UUIDUtility(DBSystem dbSystem, ErrorLogger errorLogger) {
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
public static Optional<UUID> parseFromString(String uuidString) { public static Optional<UUID> parseFromString(String uuidString) {
@ -92,7 +92,7 @@ public class UUIDUtility {
try { try {
return dbSystem.getDatabase().query(UserIdentifierQueries.fetchPlayerUUIDOf(playerName)); return dbSystem.getDatabase().query(UserIdentifierQueries.fetchPlayerUUIDOf(playerName));
} catch (DBOpException e) { } catch (DBOpException e) {
errorHandler.log(L.ERROR, UUIDUtility.class, e); errorLogger.log(L.ERROR, UUIDUtility.class, e);
return Optional.empty(); return Optional.empty();
} }
} }

View File

@ -19,9 +19,9 @@ package com.djrapitops.plan.processing;
import com.djrapitops.plan.SubSystem; import com.djrapitops.plan.SubSystem;
import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.lang.PluginLang; import com.djrapitops.plan.settings.locale.lang.PluginLang;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import dagger.Lazy; import dagger.Lazy;
import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.apache.commons.lang3.concurrent.BasicThreadFactory;
@ -35,7 +35,7 @@ public class Processing implements SubSystem {
private final Lazy<Locale> locale; private final Lazy<Locale> locale;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private ExecutorService nonCriticalExecutor; private ExecutorService nonCriticalExecutor;
private ExecutorService criticalExecutor; private ExecutorService criticalExecutor;
@ -44,11 +44,11 @@ public class Processing implements SubSystem {
public Processing( public Processing(
Lazy<Locale> locale, Lazy<Locale> locale,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.locale = locale; this.locale = locale;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
nonCriticalExecutor = createExecutor(6, "Plan Non critical-pool-%d"); nonCriticalExecutor = createExecutor(6, "Plan Non critical-pool-%d");
criticalExecutor = createExecutor(2, "Plan Critical-pool-%d"); criticalExecutor = createExecutor(2, "Plan Critical-pool-%d");
} }
@ -58,7 +58,7 @@ public class Processing implements SubSystem {
new BasicThreadFactory.Builder() new BasicThreadFactory.Builder()
.namingPattern(s) .namingPattern(s)
.uncaughtExceptionHandler((thread, throwable) -> .uncaughtExceptionHandler((thread, throwable) ->
errorHandler.log(L.WARN, Processing.class, throwable) errorLogger.log(L.WARN, Processing.class, throwable)
).build()); ).build());
} }
@ -110,14 +110,14 @@ public class Processing implements SubSystem {
private <T> T exceptionHandlerNonCritical(T t, Throwable throwable) { private <T> T exceptionHandlerNonCritical(T t, Throwable throwable) {
if (throwable != null) { if (throwable != null) {
errorHandler.log(L.WARN, Processing.class, throwable.getCause()); errorLogger.log(L.WARN, Processing.class, throwable.getCause());
} }
return t; return t;
} }
private <T> T exceptionHandlerCritical(T t, Throwable throwable) { private <T> T exceptionHandlerCritical(T t, Throwable throwable) {
if (throwable != null) { if (throwable != null) {
errorHandler.log(L.ERROR, Processing.class, throwable.getCause()); errorLogger.log(L.ERROR, Processing.class, throwable.getCause());
} }
return t; return t;
} }
@ -163,7 +163,7 @@ public class Processing implements SubSystem {
try { try {
runnable.run(); runnable.run();
} catch (Exception | NoClassDefFoundError | NoSuchMethodError | NoSuchFieldError e) { } catch (Exception | NoClassDefFoundError | NoSuchMethodError | NoSuchFieldError e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }
} }

View File

@ -23,9 +23,9 @@ import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.QueryAPIExecutable; import com.djrapitops.plan.storage.database.queries.QueryAPIExecutable;
import com.djrapitops.plan.storage.database.queries.QueryAPIQuery; import com.djrapitops.plan.storage.database.queries.QueryAPIQuery;
import com.djrapitops.plan.storage.database.transactions.Transaction; import com.djrapitops.plan.storage.database.transactions.Transaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -43,7 +43,7 @@ public class QuerySvc implements QueryService {
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final Set<Consumer<UUID>> playerRemoveSubscribers; private final Set<Consumer<UUID>> playerRemoveSubscribers;
private final Set<VoidFunction> clearSubscribers; private final Set<VoidFunction> clearSubscribers;
@ -53,12 +53,12 @@ public class QuerySvc implements QueryService {
DBSystem dbSystem, DBSystem dbSystem,
ServerInfo serverInfo, ServerInfo serverInfo,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
playerRemoveSubscribers = new HashSet<>(); playerRemoveSubscribers = new HashSet<>();
clearSubscribers = new HashSet<>(); clearSubscribers = new HashSet<>();
@ -108,7 +108,7 @@ public class QuerySvc implements QueryService {
subscriber.accept(playerUUID); subscriber.accept(playerUUID);
} catch (DBOpException e) { } catch (DBOpException e) {
logger.warn("User of Query API (" + subscriber.getClass().getName() + ") ran into exception, failed safely:"); logger.warn("User of Query API (" + subscriber.getClass().getName() + ") ran into exception, failed safely:");
errorHandler.log(L.WARN, QueryService.class, e); errorLogger.log(L.WARN, QueryService.class, e);
} }
}); });
} }
@ -119,7 +119,7 @@ public class QuerySvc implements QueryService {
function.apply(); function.apply();
} catch (DBOpException e) { } catch (DBOpException e) {
logger.warn("User of Query API (" + function.getClass().getName() + ") ran into exception, failed safely:"); logger.warn("User of Query API (" + function.getClass().getName() + ") ran into exception, failed safely:");
errorHandler.log(L.WARN, QueryService.class, e); errorLogger.log(L.WARN, QueryService.class, e);
} }
}); });
} }

View File

@ -24,8 +24,8 @@ import com.djrapitops.plan.settings.config.paths.PluginSettings;
import com.djrapitops.plan.settings.network.ServerSettingsManager; import com.djrapitops.plan.settings.network.ServerSettingsManager;
import com.djrapitops.plan.settings.theme.Theme; import com.djrapitops.plan.settings.theme.Theme;
import com.djrapitops.plan.storage.file.PlanFiles; import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -52,9 +52,9 @@ public class BukkitConfigSystem extends ConfigSystem {
ServerSettingsManager serverSettingsManager, ServerSettingsManager serverSettingsManager,
Theme theme, Theme theme,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super(files, config, theme, logger, errorHandler); super(files, config, theme, logger, errorLogger);
this.configUpdater = configUpdater; this.configUpdater = configUpdater;
this.serverSettingsManager = serverSettingsManager; this.serverSettingsManager = serverSettingsManager;
} }

View File

@ -24,10 +24,10 @@ import com.djrapitops.plan.settings.config.paths.FormatSettings;
import com.djrapitops.plan.settings.config.paths.PluginSettings; import com.djrapitops.plan.settings.config.paths.PluginSettings;
import com.djrapitops.plan.settings.theme.Theme; import com.djrapitops.plan.settings.theme.Theme;
import com.djrapitops.plan.storage.file.PlanFiles; import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.debug.*; import com.djrapitops.plugin.logging.debug.*;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -46,20 +46,20 @@ public abstract class ConfigSystem implements SubSystem {
protected final PlanConfig config; protected final PlanConfig config;
protected final Theme theme; protected final Theme theme;
protected final PluginLogger logger; protected final PluginLogger logger;
protected final ErrorHandler errorHandler; protected final ErrorLogger errorLogger;
public ConfigSystem( public ConfigSystem(
PlanFiles files, PlanFiles files,
PlanConfig config, PlanConfig config,
Theme theme, Theme theme,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.files = files; this.files = files;
this.config = config; this.config = config;
this.theme = theme; this.theme = theme;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
public PlanConfig getConfig() { public PlanConfig getConfig() {
@ -86,7 +86,7 @@ public abstract class ConfigSystem implements SubSystem {
checkWrongTimeZone(); checkWrongTimeZone();
} catch (IOException e) { } catch (IOException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
throw new EnableException("Failed to save default config: " + e.getMessage(), e); throw new EnableException("Failed to save default config: " + e.getMessage(), e);
} }
theme.enable(); theme.enable();
@ -110,7 +110,7 @@ public abstract class ConfigSystem implements SubSystem {
loggers.add(new ConsoleDebugLogger(logger)); loggers.add(new ConsoleDebugLogger(logger));
} }
if (Verify.containsOne(debugMode, "true", "both", "all", "file")) { if (Verify.containsOne(debugMode, "true", "both", "all", "file")) {
loggers.add(new FolderTimeStampFileDebugLogger(files.getLogsFolder(), () -> errorHandler)); loggers.add(new FolderTimeStampFileDebugLogger(files.getLogsFolder(), () -> errorLogger));
} }
if (Verify.containsOne(debugMode, "true", "both", "all", "memory")) { if (Verify.containsOne(debugMode, "true", "both", "all", "memory")) {
loggers.add(debugLogger.getDebugLogger(MemoryDebugLogger.class).orElse(new MemoryDebugLogger())); loggers.add(debugLogger.getDebugLogger(MemoryDebugLogger.class).orElse(new MemoryDebugLogger()));
@ -134,7 +134,7 @@ public abstract class ConfigSystem implements SubSystem {
try { try {
config.read(); config.read();
} catch (IOException e) { } catch (IOException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }
} }

View File

@ -25,8 +25,8 @@ import com.djrapitops.plan.settings.config.paths.PluginSettings;
import com.djrapitops.plan.settings.network.ServerSettingsManager; import com.djrapitops.plan.settings.network.ServerSettingsManager;
import com.djrapitops.plan.settings.theme.Theme; import com.djrapitops.plan.settings.theme.Theme;
import com.djrapitops.plan.storage.file.PlanFiles; import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -54,9 +54,9 @@ public class NukkitConfigSystem extends ConfigSystem {
ServerSettingsManager serverSettingsManager, ServerSettingsManager serverSettingsManager,
Theme theme, Theme theme,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super(files, config, theme, logger, errorHandler); super(files, config, theme, logger, errorLogger);
this.configUpdater = configUpdater; this.configUpdater = configUpdater;
this.serverSettingsManager = serverSettingsManager; this.serverSettingsManager = serverSettingsManager;
} }

View File

@ -23,8 +23,8 @@ import com.djrapitops.plan.settings.config.changes.ConfigUpdater;
import com.djrapitops.plan.settings.network.NetworkSettingManager; import com.djrapitops.plan.settings.network.NetworkSettingManager;
import com.djrapitops.plan.settings.theme.Theme; import com.djrapitops.plan.settings.theme.Theme;
import com.djrapitops.plan.storage.file.PlanFiles; import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -51,9 +51,9 @@ public class ProxyConfigSystem extends ConfigSystem {
NetworkSettingManager networkSettingManager, NetworkSettingManager networkSettingManager,
Theme theme, Theme theme,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super(files, config, theme, logger, errorHandler); super(files, config, theme, logger, errorLogger);
this.configUpdater = configUpdater; this.configUpdater = configUpdater;
this.networkSettingManager = networkSettingManager; this.networkSettingManager = networkSettingManager;
} }

View File

@ -18,8 +18,8 @@ package com.djrapitops.plan.settings;
import com.djrapitops.plan.settings.config.ConfigNode; import com.djrapitops.plan.settings.config.ConfigNode;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -37,15 +37,15 @@ import java.util.function.Supplier;
public class SettingsSvc implements SettingsService { public class SettingsSvc implements SettingsService {
private final PlanConfig config; private final PlanConfig config;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public SettingsSvc( public SettingsSvc(
PlanConfig config, PlanConfig config,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.config = config; this.config = config;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
public void register() { public void register() {
@ -70,7 +70,7 @@ public class SettingsSvc implements SettingsService {
try { try {
config.save(); config.save();
} catch (IOException e) { } catch (IOException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -24,8 +24,8 @@ import com.djrapitops.plan.settings.config.paths.WebserverSettings;
import com.djrapitops.plan.settings.network.ServerSettingsManager; import com.djrapitops.plan.settings.network.ServerSettingsManager;
import com.djrapitops.plan.settings.theme.Theme; import com.djrapitops.plan.settings.theme.Theme;
import com.djrapitops.plan.storage.file.PlanFiles; import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -49,9 +49,9 @@ public class SpongeConfigSystem extends BukkitConfigSystem {
ServerSettingsManager serverSettingsManager, ServerSettingsManager serverSettingsManager,
Theme theme, Theme theme,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super(files, config, configUpdater, serverSettingsManager, theme, logger, errorHandler); super(files, config, configUpdater, serverSettingsManager, theme, logger, errorLogger);
} }
@Override @Override

View File

@ -27,8 +27,8 @@ import com.djrapitops.plan.settings.config.paths.DisplaySettings;
import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.lang.GenericLang; import com.djrapitops.plan.settings.locale.lang.GenericLang;
import com.djrapitops.plan.settings.locale.lang.HtmlLang; import com.djrapitops.plan.settings.locale.lang.HtmlLang;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import dagger.Lazy; import dagger.Lazy;
@ -52,7 +52,7 @@ public class WorldAliasSettings {
private final Supplier<Formatter<Double>> percentageFormatter; private final Supplier<Formatter<Double>> percentageFormatter;
private final Lazy<Locale> locale; private final Lazy<Locale> locale;
private final Processing processing; private final Processing processing;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public WorldAliasSettings( public WorldAliasSettings(
@ -60,12 +60,12 @@ public class WorldAliasSettings {
Lazy<Locale> locale, Lazy<Locale> locale,
Lazy<Formatters> formatters, Lazy<Formatters> formatters,
Processing processing, Processing processing,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.config = config; this.config = config;
this.locale = locale; this.locale = locale;
this.processing = processing; this.processing = processing;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
percentageFormatter = () -> formatters.get().percentage(); percentageFormatter = () -> formatters.get().percentage();
} }
@ -93,7 +93,7 @@ public class WorldAliasSettings {
try { try {
aliasSect.save(); aliasSect.save();
} catch (IOException e) { } catch (IOException e) {
errorHandler.log(L.WARN, WorldAliasSettings.class, e); errorLogger.log(L.WARN, WorldAliasSettings.class, e);
} }
}); });
} }

View File

@ -18,9 +18,9 @@ package com.djrapitops.plan.settings.config.changes;
import com.djrapitops.plan.settings.config.Config; import com.djrapitops.plan.settings.config.Config;
import com.djrapitops.plan.settings.config.paths.FormatSettings; import com.djrapitops.plan.settings.config.paths.FormatSettings;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -35,15 +35,15 @@ import java.io.IOException;
public class ConfigUpdater { public class ConfigUpdater {
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public ConfigUpdater( public ConfigUpdater(
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
public void applyConfigUpdate(Config config) throws IOException { public void applyConfigUpdate(Config config) throws IOException {
@ -152,7 +152,7 @@ public class ConfigUpdater {
logger.info("Config: " + change.getAppliedMessage()); logger.info("Config: " + change.getAppliedMessage());
} }
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), new IllegalStateException("Failed to apply config update: '" + change.getAppliedMessage() + "'", e)); errorLogger.log(L.WARN, this.getClass(), new IllegalStateException("Failed to apply config update: '" + change.getAppliedMessage() + "'", e));
} }
} }
} }

View File

@ -22,9 +22,9 @@ import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.PluginSettings; import com.djrapitops.plan.settings.config.paths.PluginSettings;
import com.djrapitops.plan.settings.locale.lang.*; import com.djrapitops.plan.settings.locale.lang.*;
import com.djrapitops.plan.storage.file.PlanFiles; import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -47,7 +47,7 @@ public class LocaleSystem implements SubSystem {
private final PlanFiles files; private final PlanFiles files;
private final PlanConfig config; private final PlanConfig config;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final Locale locale; private final Locale locale;
@ -56,12 +56,12 @@ public class LocaleSystem implements SubSystem {
PlanFiles files, PlanFiles files,
PlanConfig config, PlanConfig config,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.files = files; this.files = files;
this.config = config; this.config = config;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
this.locale = new Locale(); this.locale = new Locale();
} }
@ -113,7 +113,7 @@ public class LocaleSystem implements SubSystem {
new LocaleFileWriter(writing).writeToFile(localeFile); new LocaleFileWriter(writing).writeToFile(localeFile);
} catch (IOException | IllegalStateException e) { } catch (IOException | IllegalStateException e) {
logger.error("Failed to write new Locale file at " + localeFile.getAbsolutePath()); logger.error("Failed to write new Locale file at " + localeFile.getAbsolutePath());
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
resetWriteConfigSetting(); resetWriteConfigSetting();
} }
@ -124,7 +124,7 @@ public class LocaleSystem implements SubSystem {
config.save(); config.save();
} catch (IOException | IllegalStateException e) { } catch (IOException | IllegalStateException e) {
logger.error("Failed set WriteNewLocaleFileOnEnable back to false"); logger.error("Failed set WriteNewLocaleFileOnEnable back to false");
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }

View File

@ -30,9 +30,9 @@ import com.djrapitops.plan.storage.database.queries.objects.NewerConfigQuery;
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries; import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
import com.djrapitops.plan.storage.database.transactions.StoreConfigTransaction; import com.djrapitops.plan.storage.database.transactions.StoreConfigTransaction;
import com.djrapitops.plan.storage.file.PlanFiles; import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.AbsRunnable;
import com.djrapitops.plugin.task.RunnableFactory; import com.djrapitops.plugin.task.RunnableFactory;
@ -66,7 +66,7 @@ public class NetworkSettingManager implements SubSystem {
private final RunnableFactory runnableFactory; private final RunnableFactory runnableFactory;
private final PlanConfig config; private final PlanConfig config;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private File serverSettingsFolder; private File serverSettingsFolder;
@ -80,7 +80,7 @@ public class NetworkSettingManager implements SubSystem {
ServerInfo serverInfo, ServerInfo serverInfo,
RunnableFactory runnableFactory, RunnableFactory runnableFactory,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.files = files; this.files = files;
this.config = config; this.config = config;
@ -89,7 +89,7 @@ public class NetworkSettingManager implements SubSystem {
this.runnableFactory = runnableFactory; this.runnableFactory = runnableFactory;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Override @Override
@ -117,7 +117,7 @@ public class NetworkSettingManager implements SubSystem {
} }
private FileWatcher prepareFileWatcher() { private FileWatcher prepareFileWatcher() {
FileWatcher fileWatcher = new FileWatcher(serverSettingsFolder, errorHandler); FileWatcher fileWatcher = new FileWatcher(serverSettingsFolder, errorLogger);
File[] files = getConfigFiles(); File[] files = getConfigFiles();
if (files != null) { if (files != null) {

View File

@ -31,9 +31,9 @@ import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.queries.objects.NewerConfigQuery; import com.djrapitops.plan.storage.database.queries.objects.NewerConfigQuery;
import com.djrapitops.plan.storage.database.transactions.StoreConfigTransaction; import com.djrapitops.plan.storage.database.transactions.StoreConfigTransaction;
import com.djrapitops.plan.storage.file.PlanFiles; import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.AbsRunnable;
import javax.inject.Inject; import javax.inject.Inject;
@ -63,7 +63,7 @@ public class ServerSettingsManager implements SubSystem {
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final TaskSystem taskSystem; private final TaskSystem taskSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final PluginLogger logger; private final PluginLogger logger;
private FileWatcher watcher; private FileWatcher watcher;
@ -75,7 +75,7 @@ public class ServerSettingsManager implements SubSystem {
ServerInfo serverInfo, ServerInfo serverInfo,
TaskSystem taskSystem, TaskSystem taskSystem,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.files = files; this.files = files;
this.config = config; this.config = config;
@ -83,7 +83,7 @@ public class ServerSettingsManager implements SubSystem {
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.taskSystem = taskSystem; this.taskSystem = taskSystem;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Override @Override
@ -95,7 +95,7 @@ public class ServerSettingsManager implements SubSystem {
} }
private FileWatcher prepareFileWatcher() { private FileWatcher prepareFileWatcher() {
FileWatcher fileWatcher = new FileWatcher(files.getDataFolder(), errorHandler); FileWatcher fileWatcher = new FileWatcher(files.getDataFolder(), errorLogger);
File configFile = files.getConfigFile(); File configFile = files.getConfigFile();
fileWatcher.addToWatchlist(new WatchedFile(configFile, fileWatcher.addToWatchlist(new WatchedFile(configFile,
() -> updateConfigInDB(configFile) () -> updateConfigInDB(configFile)

View File

@ -16,8 +16,8 @@
*/ */
package com.djrapitops.plan.settings.upkeep; package com.djrapitops.plan.settings.upkeep;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
import java.io.File; import java.io.File;
@ -36,7 +36,7 @@ import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
*/ */
public class FileWatcher extends Thread { public class FileWatcher extends Thread {
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private volatile boolean running; private volatile boolean running;
@ -45,16 +45,16 @@ public class FileWatcher extends Thread {
public FileWatcher( public FileWatcher(
File folder, File folder,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this(folder.toPath(), errorHandler); this(folder.toPath(), errorLogger);
} }
public FileWatcher( public FileWatcher(
Path watchedPath, Path watchedPath,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
this.running = false; this.running = false;
this.watchedFiles = Collections.newSetFromMap(new ConcurrentHashMap<>()); this.watchedFiles = Collections.newSetFromMap(new ConcurrentHashMap<>());
@ -75,7 +75,7 @@ public class FileWatcher extends Thread {
watchedPath.register(watcher, ENTRY_MODIFY); watchedPath.register(watcher, ENTRY_MODIFY);
runLoop(watcher); runLoop(watcher);
} catch (IOException e) { } catch (IOException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
interrupt(); interrupt();
} catch (InterruptedException e) { } catch (InterruptedException e) {
interrupt(); interrupt();

View File

@ -25,8 +25,8 @@ import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.storage.upkeep.DBKeepAliveTask; import com.djrapitops.plan.storage.upkeep.DBKeepAliveTask;
import com.djrapitops.plan.utilities.MiscUtils; import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.java.ThrowableUtils; import com.djrapitops.plan.utilities.java.ThrowableUtils;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.task.PluginTask; import com.djrapitops.plugin.task.PluginTask;
import com.djrapitops.plugin.task.RunnableFactory; import com.djrapitops.plugin.task.RunnableFactory;
import dagger.Lazy; import dagger.Lazy;
@ -58,9 +58,9 @@ public class H2DB extends SQLDB {
Lazy<ServerInfo> serverInfo, Lazy<ServerInfo> serverInfo,
RunnableFactory runnableFactory, RunnableFactory runnableFactory,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super(() -> serverInfo.get().getServerUUID(), locale, config, runnableFactory, logger, errorHandler); super(() -> serverInfo.get().getServerUUID(), locale, config, runnableFactory, logger, errorLogger);
dbName = databaseFile.getName(); dbName = databaseFile.getName();
this.databaseFile = databaseFile; this.databaseFile = databaseFile;
} }
@ -102,7 +102,7 @@ public class H2DB extends SQLDB {
try { try {
// Maintains Connection. // Maintains Connection.
connectionPingTask = runnableFactory.create("DBConnectionPingTask " + getType().getName(), connectionPingTask = runnableFactory.create("DBConnectionPingTask " + getType().getName(),
new DBKeepAliveTask(connection, () -> getNewConnection(databaseFile), logger, errorHandler) new DBKeepAliveTask(connection, () -> getNewConnection(databaseFile), logger, errorLogger)
).runTaskTimerAsynchronously(60L * 20L, 60L * 20L); ).runTaskTimerAsynchronously(60L * 20L, 60L * 20L);
} catch (Exception ignored) { } catch (Exception ignored) {
// Task failed to register because plugin is being disabled // Task failed to register because plugin is being disabled
@ -175,7 +175,7 @@ public class H2DB extends SQLDB {
private final Lazy<ServerInfo> serverInfo; private final Lazy<ServerInfo> serverInfo;
private final RunnableFactory runnableFactory; private final RunnableFactory runnableFactory;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger1;
private final PlanFiles files; private final PlanFiles files;
@Inject @Inject
@ -186,7 +186,7 @@ public class H2DB extends SQLDB {
Lazy<ServerInfo> serverInfo, Lazy<ServerInfo> serverInfo,
RunnableFactory runnableFactory, RunnableFactory runnableFactory,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger1
) { ) {
this.locale = locale; this.locale = locale;
this.config = config; this.config = config;
@ -194,7 +194,7 @@ public class H2DB extends SQLDB {
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.runnableFactory = runnableFactory; this.runnableFactory = runnableFactory;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger1 = errorLogger1;
} }
public H2DB usingDefaultFile() { public H2DB usingDefaultFile() {
@ -208,7 +208,7 @@ public class H2DB extends SQLDB {
public H2DB usingFile(File databaseFile) { public H2DB usingFile(File databaseFile) {
return new H2DB(databaseFile, return new H2DB(databaseFile,
locale, config, serverInfo, locale, config, serverInfo,
runnableFactory, logger, errorHandler runnableFactory, logger, errorLogger1
); );
} }

View File

@ -23,10 +23,9 @@ import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.DatabaseSettings; import com.djrapitops.plan.settings.config.paths.DatabaseSettings;
import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.locale.lang.PluginLang; import com.djrapitops.plan.settings.locale.lang.PluginLang;
import com.djrapitops.plugin.benchmarking.Timings; import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.task.RunnableFactory; import com.djrapitops.plugin.task.RunnableFactory;
import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.HikariDataSource;
@ -59,10 +58,9 @@ public class MySQLDB extends SQLDB {
Lazy<ServerInfo> serverInfo, Lazy<ServerInfo> serverInfo,
RunnableFactory runnableFactory, RunnableFactory runnableFactory,
PluginLogger pluginLogger, PluginLogger pluginLogger,
Timings timings, ErrorLogger errorLogger
ErrorHandler errorHandler
) { ) {
super(() -> serverInfo.get().getServerUUID(), locale, config, runnableFactory, pluginLogger, errorHandler); super(() -> serverInfo.get().getServerUUID(), locale, config, runnableFactory, pluginLogger, errorLogger);
} }
private static synchronized void increment() { private static synchronized void increment() {
@ -78,7 +76,7 @@ public class MySQLDB extends SQLDB {
try { try {
Class.forName("com.mysql.cj.jdbc.Driver"); Class.forName("com.mysql.cj.jdbc.Driver");
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
errorHandler.log(L.CRITICAL, this.getClass(), e); errorLogger.log(L.CRITICAL, this.getClass(), e);
} }
} }
@ -166,7 +164,7 @@ public class MySQLDB extends SQLDB {
connection.close(); connection.close();
} }
} catch (SQLException e) { } catch (SQLException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -17,9 +17,7 @@
package com.djrapitops.plan.storage.database; package com.djrapitops.plan.storage.database;
import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plugin.benchmarking.Timings;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -38,9 +36,7 @@ public class ProxyDBSystem extends DBSystem {
MySQLDB mySQLDB, MySQLDB mySQLDB,
SQLiteDB.Factory sqLiteDB, SQLiteDB.Factory sqLiteDB,
H2DB.Factory h2DB, H2DB.Factory h2DB,
PluginLogger logger, PluginLogger logger
Timings timings,
ErrorHandler errorHandler
) { ) {
super(locale, sqLiteDB, h2DB, logger); super(locale, sqLiteDB, h2DB, logger);
databases.add(mySQLDB); databases.add(mySQLDB);

View File

@ -31,10 +31,10 @@ import com.djrapitops.plan.storage.database.transactions.init.CreateTablesTransa
import com.djrapitops.plan.storage.database.transactions.init.OperationCriticalTransaction; import com.djrapitops.plan.storage.database.transactions.init.OperationCriticalTransaction;
import com.djrapitops.plan.storage.database.transactions.patches.*; import com.djrapitops.plan.storage.database.transactions.patches.*;
import com.djrapitops.plan.utilities.java.ThrowableUtils; import com.djrapitops.plan.utilities.java.ThrowableUtils;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.AbsRunnable;
import com.djrapitops.plugin.task.RunnableFactory; import com.djrapitops.plugin.task.RunnableFactory;
import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.apache.commons.lang3.concurrent.BasicThreadFactory;
@ -62,7 +62,7 @@ public abstract class SQLDB extends AbstractDatabase {
protected final PlanConfig config; protected final PlanConfig config;
protected final RunnableFactory runnableFactory; protected final RunnableFactory runnableFactory;
protected final PluginLogger logger; protected final PluginLogger logger;
protected final ErrorHandler errorHandler; protected final ErrorLogger errorLogger;
private Supplier<ExecutorService> transactionExecutorServiceProvider; private Supplier<ExecutorService> transactionExecutorServiceProvider;
private ExecutorService transactionExecutor; private ExecutorService transactionExecutor;
@ -75,14 +75,14 @@ public abstract class SQLDB extends AbstractDatabase {
PlanConfig config, PlanConfig config,
RunnableFactory runnableFactory, RunnableFactory runnableFactory,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.serverUUIDSupplier = serverUUIDSupplier; this.serverUUIDSupplier = serverUUIDSupplier;
this.locale = locale; this.locale = locale;
this.config = config; this.config = config;
this.runnableFactory = runnableFactory; this.runnableFactory = runnableFactory;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
devMode = config.isTrue(PluginSettings.DEV_MODE); devMode = config.isTrue(PluginSettings.DEV_MODE);
@ -92,7 +92,7 @@ public abstract class SQLDB extends AbstractDatabase {
.namingPattern(nameFormat) .namingPattern(nameFormat)
.uncaughtExceptionHandler((thread, throwable) -> { .uncaughtExceptionHandler((thread, throwable) -> {
if (devMode) { if (devMode) {
errorHandler.log(L.WARN, getClass(), throwable); errorLogger.log(L.WARN, getClass(), throwable);
} }
}).build()); }).build());
}; };
@ -261,7 +261,7 @@ public abstract class SQLDB extends AbstractDatabase {
} }
ThrowableUtils.appendEntryPointToCause(throwable, origin); ThrowableUtils.appendEntryPointToCause(throwable, origin);
errorHandler.log(L.ERROR, getClass(), throwable); errorLogger.log(L.ERROR, getClass(), throwable);
return CompletableFuture.completedFuture(null); return CompletableFuture.completedFuture(null);
}; };
} }

View File

@ -25,9 +25,9 @@ import com.djrapitops.plan.storage.file.PlanFiles;
import com.djrapitops.plan.storage.upkeep.DBKeepAliveTask; import com.djrapitops.plan.storage.upkeep.DBKeepAliveTask;
import com.djrapitops.plan.utilities.MiscUtils; import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.java.ThrowableUtils; import com.djrapitops.plan.utilities.java.ThrowableUtils;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.task.PluginTask; import com.djrapitops.plugin.task.PluginTask;
import com.djrapitops.plugin.task.RunnableFactory; import com.djrapitops.plugin.task.RunnableFactory;
import dagger.Lazy; import dagger.Lazy;
@ -57,9 +57,9 @@ public class SQLiteDB extends SQLDB {
Lazy<ServerInfo> serverInfo, Lazy<ServerInfo> serverInfo,
RunnableFactory runnableFactory, RunnableFactory runnableFactory,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super(() -> serverInfo.get().getServerUUID(), locale, config, runnableFactory, logger, errorHandler); super(() -> serverInfo.get().getServerUUID(), locale, config, runnableFactory, logger, errorLogger);
dbName = databaseFile.getName(); dbName = databaseFile.getName();
this.databaseFile = databaseFile; this.databaseFile = databaseFile;
} }
@ -80,7 +80,7 @@ public class SQLiteDB extends SQLDB {
try { try {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
errorHandler.log(L.CRITICAL, this.getClass(), e); errorLogger.log(L.CRITICAL, this.getClass(), e);
return null; // Should never happen. return null; // Should never happen.
} }
@ -106,7 +106,7 @@ public class SQLiteDB extends SQLDB {
try { try {
// Maintains Connection. // Maintains Connection.
connectionPingTask = runnableFactory.create("DBConnectionPingTask " + getType().getName(), connectionPingTask = runnableFactory.create("DBConnectionPingTask " + getType().getName(),
new DBKeepAliveTask(connection, () -> getNewConnection(databaseFile), logger, errorHandler) new DBKeepAliveTask(connection, () -> getNewConnection(databaseFile), logger, errorLogger)
).runTaskTimerAsynchronously(60L * 20L, 60L * 20L); ).runTaskTimerAsynchronously(60L * 20L, 60L * 20L);
} catch (Exception ignored) { } catch (Exception ignored) {
// Task failed to register because plugin is being disabled // Task failed to register because plugin is being disabled
@ -177,7 +177,7 @@ public class SQLiteDB extends SQLDB {
private final Lazy<ServerInfo> serverInfo; private final Lazy<ServerInfo> serverInfo;
private final RunnableFactory runnableFactory; private final RunnableFactory runnableFactory;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger1;
private final PlanFiles files; private final PlanFiles files;
@Inject @Inject
@ -188,7 +188,7 @@ public class SQLiteDB extends SQLDB {
Lazy<ServerInfo> serverInfo, Lazy<ServerInfo> serverInfo,
RunnableFactory runnableFactory, RunnableFactory runnableFactory,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger1
) { ) {
this.locale = locale; this.locale = locale;
this.config = config; this.config = config;
@ -196,7 +196,7 @@ public class SQLiteDB extends SQLDB {
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.runnableFactory = runnableFactory; this.runnableFactory = runnableFactory;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger1 = errorLogger1;
} }
public SQLiteDB usingDefaultFile() { public SQLiteDB usingDefaultFile() {
@ -210,7 +210,7 @@ public class SQLiteDB extends SQLDB {
public SQLiteDB usingFile(File databaseFile) { public SQLiteDB usingFile(File databaseFile) {
return new SQLiteDB(databaseFile, return new SQLiteDB(databaseFile,
locale, config, serverInfo, locale, config, serverInfo,
runnableFactory, logger, errorHandler runnableFactory, logger, errorLogger1
); );
} }

View File

@ -34,9 +34,9 @@ import com.djrapitops.plan.storage.database.transactions.commands.RemovePlayerTr
import com.djrapitops.plan.storage.database.transactions.init.RemoveDuplicateUserInfoTransaction; import com.djrapitops.plan.storage.database.transactions.init.RemoveDuplicateUserInfoTransaction;
import com.djrapitops.plan.storage.database.transactions.init.RemoveOldExtensionsTransaction; import com.djrapitops.plan.storage.database.transactions.init.RemoveOldExtensionsTransaction;
import com.djrapitops.plan.storage.database.transactions.init.RemoveOldSampledDataTransaction; import com.djrapitops.plan.storage.database.transactions.init.RemoveOldSampledDataTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.AbsRunnable;
import javax.inject.Inject; import javax.inject.Inject;
@ -64,7 +64,7 @@ public class DBCleanTask extends AbsRunnable {
private final QuerySvc queryService; private final QuerySvc queryService;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
// This variable assumes that the system is thrown away on reload and new one is constructed. // This variable assumes that the system is thrown away on reload and new one is constructed.
// It is to avoid cleaning extension data that has not been updated after uptime longer than the deletion threshold. // It is to avoid cleaning extension data that has not been updated after uptime longer than the deletion threshold.
@ -78,7 +78,7 @@ public class DBCleanTask extends AbsRunnable {
QuerySvc queryService, QuerySvc queryService,
ServerInfo serverInfo, ServerInfo serverInfo,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.locale = locale; this.locale = locale;
@ -87,7 +87,7 @@ public class DBCleanTask extends AbsRunnable {
this.queryService = queryService; this.queryService = queryService;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
lastReload = System.currentTimeMillis(); lastReload = System.currentTimeMillis();
} }
@ -115,7 +115,7 @@ public class DBCleanTask extends AbsRunnable {
} }
} }
} catch (DBOpException e) { } catch (DBOpException e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
cancel(); cancel();
} }
} }

View File

@ -17,9 +17,9 @@
package com.djrapitops.plan.storage.upkeep; package com.djrapitops.plan.storage.upkeep;
import com.djrapitops.plan.utilities.MiscUtils; import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.AbsRunnable;
import java.sql.Connection; import java.sql.Connection;
@ -35,14 +35,14 @@ import java.sql.Statement;
public class DBKeepAliveTask extends AbsRunnable { public class DBKeepAliveTask extends AbsRunnable {
private final IReconnect iReconnect; private final IReconnect iReconnect;
private final PluginLogger logger; private final PluginLogger logger;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private Connection connection; private Connection connection;
public DBKeepAliveTask(Connection connection, IReconnect iReconnect, PluginLogger logger, ErrorHandler errorHandler) { public DBKeepAliveTask(Connection connection, IReconnect iReconnect, PluginLogger logger, ErrorLogger errorLogger) {
this.connection = connection; this.connection = connection;
this.iReconnect = iReconnect; this.iReconnect = iReconnect;
this.logger = logger; this.logger = logger;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Override @Override
@ -59,7 +59,7 @@ public class DBKeepAliveTask extends AbsRunnable {
try { try {
connection = iReconnect.reconnect(); connection = iReconnect.reconnect();
} catch (SQLException reconnectionError) { } catch (SQLException reconnectionError) {
errorHandler.log(L.ERROR, this.getClass(), reconnectionError); errorLogger.log(L.ERROR, this.getClass(), reconnectionError);
logger.error("SQL connection maintaining task had to be closed due to exception."); logger.error("SQL connection maintaining task had to be closed due to exception.");
this.cancel(); this.cancel();
} }

View File

@ -16,6 +16,7 @@
*/ */
package com.djrapitops.plan.gathering; package com.djrapitops.plan.gathering;
import com.djrapitops.plan.PlanSystem;
import com.djrapitops.plan.delivery.domain.keys.SessionKeys; import com.djrapitops.plan.delivery.domain.keys.SessionKeys;
import com.djrapitops.plan.gathering.cache.SessionCache; import com.djrapitops.plan.gathering.cache.SessionCache;
import com.djrapitops.plan.gathering.domain.GMTimes; import com.djrapitops.plan.gathering.domain.GMTimes;
@ -30,7 +31,6 @@ import com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythi
import com.djrapitops.plan.storage.database.transactions.events.PlayerRegisterTransaction; import com.djrapitops.plan.storage.database.transactions.events.PlayerRegisterTransaction;
import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction; import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction;
import com.djrapitops.plugin.logging.console.TestPluginLogger; import com.djrapitops.plugin.logging.console.TestPluginLogger;
import com.djrapitops.plugin.logging.error.ConsoleErrorLogger;
import extension.PrintExtension; import extension.PrintExtension;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
@ -72,11 +72,12 @@ class ShutdownSaveTest {
.withLogging() .withLogging()
.getPlanMock() .getPlanMock()
).build(); ).build();
PlanSystem system = pluginComponent.system();
database = pluginComponent.system().getDatabaseSystem().getSqLiteFactory().usingFileCalled("test"); database = system.getDatabaseSystem().getSqLiteFactory().usingFileCalled("test");
database.init(); database.init();
sessionCache = pluginComponent.system().getCacheSystem().getSessionCache(); sessionCache = system.getCacheSystem().getSessionCache();
storeNecessaryInformation(); storeNecessaryInformation();
placeSessionToCache(); placeSessionToCache();
@ -85,7 +86,7 @@ class ShutdownSaveTest {
when(dbSystemMock.getDatabase()).thenReturn(database); when(dbSystemMock.getDatabase()).thenReturn(database);
TestPluginLogger logger = new TestPluginLogger(); TestPluginLogger logger = new TestPluginLogger();
underTest = new ServerShutdownSave(new Locale(), dbSystemMock, logger, new ConsoleErrorLogger(logger)) { underTest = new ServerShutdownSave(new Locale(), dbSystemMock, logger, system.getErrorLogger()) {
@Override @Override
protected boolean checkServerShuttingDownStatus() { protected boolean checkServerShuttingDownStatus() {
return shutdownStatus; return shutdownStatus;

View File

@ -20,12 +20,14 @@ import com.djrapitops.plan.settings.ConfigSettingKeyTest;
import com.djrapitops.plan.settings.config.ConfigReader; import com.djrapitops.plan.settings.config.ConfigReader;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.key.Setting; import com.djrapitops.plan.settings.config.paths.key.Setting;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.console.TestPluginLogger; import com.djrapitops.plugin.logging.console.TestPluginLogger;
import com.djrapitops.plugin.logging.error.ConsoleErrorLogger; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.io.TempDir;
import org.mockito.Mockito;
import utilities.TestResources; import utilities.TestResources;
import java.io.File; import java.io.File;
@ -55,6 +57,7 @@ class ConfigUpdaterTest {
private static Path newBungeeConfig; private static Path newBungeeConfig;
private static ConfigUpdater UNDER_TEST; private static ConfigUpdater UNDER_TEST;
private static ErrorLogger errorLogger;
@BeforeAll @BeforeAll
static void prepareConfigFiles() throws URISyntaxException, IOException { static void prepareConfigFiles() throws URISyntaxException, IOException {
@ -73,7 +76,13 @@ class ConfigUpdaterTest {
TestResources.copyResourceIntoFile(newBungeeConfig.toFile(), "/assets/plan/bungeeconfig.yml"); TestResources.copyResourceIntoFile(newBungeeConfig.toFile(), "/assets/plan/bungeeconfig.yml");
PluginLogger testLogger = new TestPluginLogger(); PluginLogger testLogger = new TestPluginLogger();
UNDER_TEST = new ConfigUpdater(testLogger, new ConsoleErrorLogger(testLogger)); errorLogger = Mockito.mock(ErrorLogger.class);
UNDER_TEST = new ConfigUpdater(testLogger, errorLogger);
}
@AfterEach
void ensureNoErrors() {
Mockito.verifyNoInteractions(errorLogger);
} }
@Test @Test

View File

@ -42,7 +42,6 @@ import com.djrapitops.plan.storage.database.transactions.init.CreateIndexTransac
import com.djrapitops.plan.storage.database.transactions.patches.RegisterDateMinimizationPatch; import com.djrapitops.plan.storage.database.transactions.patches.RegisterDateMinimizationPatch;
import com.djrapitops.plan.storage.upkeep.DBCleanTask; import com.djrapitops.plan.storage.upkeep.DBCleanTask;
import com.djrapitops.plugin.logging.console.TestPluginLogger; import com.djrapitops.plugin.logging.console.TestPluginLogger;
import com.djrapitops.plugin.logging.error.ConsoleErrorLogger;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import utilities.FieldFetcher; import utilities.FieldFetcher;
import utilities.RandomData; import utilities.RandomData;
@ -131,15 +130,14 @@ public interface DatabaseTest extends DatabaseTestPreparer {
execute(DataStoreQueries.storeSession(session)); execute(DataStoreQueries.storeSession(session));
TestPluginLogger logger = new TestPluginLogger(); TestPluginLogger logger = new TestPluginLogger();
ConsoleErrorLogger errorHandler = new ConsoleErrorLogger(logger);
new DBCleanTask( new DBCleanTask(
system().getConfigSystem().getConfig(), system().getConfigSystem().getConfig(),
new Locale(), new Locale(),
system().getDatabaseSystem(), system().getDatabaseSystem(),
new QuerySvc(system().getDatabaseSystem(), system().getServerInfo(), logger, errorHandler), new QuerySvc(system().getDatabaseSystem(), system().getServerInfo(), logger, null),
system().getServerInfo(), system().getServerInfo(),
logger, logger,
errorHandler null
).cleanOldPlayers(db()); ).cleanOldPlayers(db());
Collection<BaseUser> found = db().query(BaseUserQueries.fetchServerBaseUsers(serverUUID())); Collection<BaseUser> found = db().query(BaseUserQueries.fetchServerBaseUsers(serverUUID()));

View File

@ -18,8 +18,8 @@ package utilities.mocks;
import com.djrapitops.plan.processing.Processing; import com.djrapitops.plan.processing.Processing;
import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.MoreExecutors;
import dagger.Lazy; import dagger.Lazy;
@ -36,8 +36,12 @@ import java.util.concurrent.ExecutorService;
public class TestProcessing extends Processing { public class TestProcessing extends Processing {
@Inject @Inject
public TestProcessing(Lazy<Locale> locale, PluginLogger logger, ErrorHandler errorHandler) { public TestProcessing(
super(locale, logger, errorHandler); Lazy<Locale> locale,
PluginLogger logger,
ErrorLogger errorLogger
) {
super(locale, logger, errorLogger);
} }
@Override @Override

View File

@ -1,4 +1,5 @@
dependencies { dependencies {
compileOnly project(":common")
compile project(path: ":common", configuration: 'shadow') compile project(path: ":common", configuration: 'shadow')
compileOnly project(":api") compileOnly project(":api")

View File

@ -19,8 +19,8 @@ package com.djrapitops.plan;
import com.djrapitops.plan.gathering.ServerShutdownSave; import com.djrapitops.plan.gathering.ServerShutdownSave;
import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -38,9 +38,9 @@ public class NukkitServerShutdownSave extends ServerShutdownSave {
Locale locale, Locale locale,
DBSystem dbSystem, DBSystem dbSystem,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super(locale, dbSystem, logger, errorHandler); super(locale, dbSystem, logger, errorLogger);
} }
@Override @Override

View File

@ -24,8 +24,8 @@ import com.djrapitops.plan.delivery.domain.keys.PlayerKeys;
import com.djrapitops.plan.gathering.cache.SessionCache; import com.djrapitops.plan.gathering.cache.SessionCache;
import com.djrapitops.plan.placeholder.PlanPlaceholders; import com.djrapitops.plan.placeholder.PlanPlaceholders;
import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries; import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -42,17 +42,17 @@ public class NukkitPlaceholderRegistrar {
private final PlanPlaceholders placeholders; private final PlanPlaceholders placeholders;
private final PlanSystem system; private final PlanSystem system;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public NukkitPlaceholderRegistrar( public NukkitPlaceholderRegistrar(
PlanPlaceholders placeholders, PlanPlaceholders placeholders,
PlanSystem system, PlanSystem system,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.placeholders = placeholders; this.placeholders = placeholders;
this.system = system; this.system = system;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
public void register() { public void register() {
@ -62,7 +62,7 @@ public class NukkitPlaceholderRegistrar {
try { try {
return loader.apply(getPlayer(player), new ArrayList<>(params.getAll().values())); return loader.apply(getPlayer(player), new ArrayList<>(params.getAll().values()));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, getClass(), e); errorLogger.log(L.WARN, getClass(), e);
return null; return null;
} }
} }
@ -73,7 +73,7 @@ public class NukkitPlaceholderRegistrar {
try { try {
return loader.apply(new ArrayList<>(params.getAll().values())); return loader.apply(new ArrayList<>(params.getAll().values()));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, getClass(), e); errorLogger.log(L.WARN, getClass(), e);
return null; return null;
} }
} }

View File

@ -26,8 +26,8 @@ import com.djrapitops.plan.gathering.cache.NicknameCache;
import com.djrapitops.plan.identification.ServerInfo; import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.transactions.events.NicknameStoreTransaction; import com.djrapitops.plan.storage.database.transactions.events.NicknameStoreTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.UUID; import java.util.UUID;
@ -42,19 +42,19 @@ public class ChatListener implements Listener {
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final NicknameCache nicknameCache; private final NicknameCache nicknameCache;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public ChatListener( public ChatListener(
ServerInfo serverInfo, ServerInfo serverInfo,
DBSystem dbSystem, DBSystem dbSystem,
NicknameCache nicknameCache, NicknameCache nicknameCache,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.nicknameCache = nicknameCache; this.nicknameCache = nicknameCache;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
@ -66,7 +66,7 @@ public class ChatListener implements Listener {
try { try {
actOnChatEvent(event); actOnChatEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -35,8 +35,8 @@ import com.djrapitops.plan.gathering.domain.Session;
import com.djrapitops.plan.processing.Processing; import com.djrapitops.plan.processing.Processing;
import com.djrapitops.plan.processing.processors.player.MobKillProcessor; import com.djrapitops.plan.processing.processors.player.MobKillProcessor;
import com.djrapitops.plan.processing.processors.player.PlayerKillProcessor; import com.djrapitops.plan.processing.processors.player.PlayerKillProcessor;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.UUID; import java.util.UUID;
@ -49,15 +49,15 @@ import java.util.UUID;
public class DeathEventListener implements Listener { public class DeathEventListener implements Listener {
private final Processing processing; private final Processing processing;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public DeathEventListener( public DeathEventListener(
Processing processing, Processing processing,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.processing = processing; this.processing = processing;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
@ -78,7 +78,7 @@ public class DeathEventListener implements Listener {
UUID uuid = dead.getUniqueId(); UUID uuid = dead.getUniqueId();
handleKill(time, uuid, killerEntity); handleKill(time, uuid, killerEntity);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }
@ -98,7 +98,7 @@ public class DeathEventListener implements Listener {
handleKill(time, /* Not a player */ null, killerEntity); handleKill(time, /* Not a player */ null, killerEntity);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -28,8 +28,8 @@ import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.settings.config.WorldAliasSettings; import com.djrapitops.plan.settings.config.WorldAliasSettings;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction; import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.Optional; import java.util.Optional;
@ -45,19 +45,19 @@ public class GameModeChangeListener implements Listener {
private final WorldAliasSettings worldAliasSettings; private final WorldAliasSettings worldAliasSettings;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public GameModeChangeListener( public GameModeChangeListener(
WorldAliasSettings worldAliasSettings, WorldAliasSettings worldAliasSettings,
ServerInfo serverInfo, ServerInfo serverInfo,
DBSystem dbSystem, DBSystem dbSystem,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.worldAliasSettings = worldAliasSettings; this.worldAliasSettings = worldAliasSettings;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
@ -68,7 +68,7 @@ public class GameModeChangeListener implements Listener {
try { try {
actOnEvent(event); actOnEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -24,8 +24,8 @@ import cn.nukkit.event.player.*;
import com.djrapitops.plan.gathering.afk.AFKTracker; import com.djrapitops.plan.gathering.afk.AFKTracker;
import com.djrapitops.plan.settings.Permissions; import com.djrapitops.plan.settings.Permissions;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.HashMap; import java.util.HashMap;
@ -46,11 +46,11 @@ public class NukkitAFKListener implements Listener {
static AFKTracker AFK_TRACKER; static AFKTracker AFK_TRACKER;
private final Map<UUID, Boolean> ignorePermissionInfo; private final Map<UUID, Boolean> ignorePermissionInfo;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public NukkitAFKListener(PlanConfig config, ErrorHandler errorHandler) { public NukkitAFKListener(PlanConfig config, ErrorLogger errorLogger) {
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
this.ignorePermissionInfo = new HashMap<>(); this.ignorePermissionInfo = new HashMap<>();
NukkitAFKListener.assignAFKTracker(config); NukkitAFKListener.assignAFKTracker(config);
@ -79,7 +79,7 @@ public class NukkitAFKListener implements Listener {
AFK_TRACKER.performedAction(uuid, time); AFK_TRACKER.performedAction(uuid, time);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -45,8 +45,8 @@ import com.djrapitops.plan.settings.config.paths.ExportSettings;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.transactions.events.*; import com.djrapitops.plan.storage.database.transactions.events.*;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.UUID; import java.util.UUID;
@ -68,7 +68,7 @@ public class PlayerOnlineListener implements Listener {
private final GeolocationCache geolocationCache; private final GeolocationCache geolocationCache;
private final NicknameCache nicknameCache; private final NicknameCache nicknameCache;
private final SessionCache sessionCache; private final SessionCache sessionCache;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
private final Status status; private final Status status;
@Inject @Inject
@ -83,7 +83,7 @@ public class PlayerOnlineListener implements Listener {
NicknameCache nicknameCache, NicknameCache nicknameCache,
SessionCache sessionCache, SessionCache sessionCache,
Status status, Status status,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.config = config; this.config = config;
this.processing = processing; this.processing = processing;
@ -95,7 +95,7 @@ public class PlayerOnlineListener implements Listener {
this.nicknameCache = nicknameCache; this.nicknameCache = nicknameCache;
this.sessionCache = sessionCache; this.sessionCache = sessionCache;
this.status = status; this.status = status;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
@ -105,7 +105,7 @@ public class PlayerOnlineListener implements Listener {
boolean operator = event.getPlayer().isOp(); boolean operator = event.getPlayer().isOp();
dbSystem.getDatabase().executeTransaction(new OperatorStatusTransaction(playerUUID, operator)); dbSystem.getDatabase().executeTransaction(new OperatorStatusTransaction(playerUUID, operator));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }
@ -130,7 +130,7 @@ public class PlayerOnlineListener implements Listener {
dbSystem.getDatabase().executeTransaction(new KickStoreTransaction(uuid)); dbSystem.getDatabase().executeTransaction(new KickStoreTransaction(uuid));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }
@ -139,7 +139,7 @@ public class PlayerOnlineListener implements Listener {
try { try {
actOnJoinEvent(event); actOnJoinEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }
@ -204,7 +204,7 @@ public class PlayerOnlineListener implements Listener {
try { try {
actOnQuitEvent(event); actOnQuitEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -28,8 +28,8 @@ import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.settings.config.WorldAliasSettings; import com.djrapitops.plan.settings.config.WorldAliasSettings;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction; import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.Optional; import java.util.Optional;
@ -40,19 +40,19 @@ public class WorldChangeListener implements Listener {
private final WorldAliasSettings worldAliasSettings; private final WorldAliasSettings worldAliasSettings;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public WorldChangeListener( public WorldChangeListener(
WorldAliasSettings worldAliasSettings, WorldAliasSettings worldAliasSettings,
ServerInfo serverInfo, ServerInfo serverInfo,
DBSystem dbSystem, DBSystem dbSystem,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.worldAliasSettings = worldAliasSettings; this.worldAliasSettings = worldAliasSettings;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
@ -61,7 +61,7 @@ public class WorldChangeListener implements Listener {
try { try {
actOnEvent(event); actOnEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }
} }

View File

@ -36,12 +36,10 @@ import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.debug.CombineDebugLogger; import com.djrapitops.plugin.logging.debug.CombineDebugLogger;
import com.djrapitops.plugin.logging.debug.DebugLogger; import com.djrapitops.plugin.logging.debug.DebugLogger;
import com.djrapitops.plugin.logging.debug.MemoryDebugLogger; import com.djrapitops.plugin.logging.debug.MemoryDebugLogger;
import com.djrapitops.plugin.logging.error.DefaultErrorHandler;
import com.djrapitops.plugin.logging.error.ErrorHandler; import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.plugin.task.RunnableFactory; import com.djrapitops.plugin.task.RunnableFactory;
import com.djrapitops.plugin.task.nukkit.NukkitRunnableFactory; import com.djrapitops.plugin.task.nukkit.NukkitRunnableFactory;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -54,7 +52,6 @@ import java.util.Map;
public class NukkitPlugin extends PluginBase implements APFPlugin { public class NukkitPlugin extends PluginBase implements APFPlugin {
protected final CombineDebugLogger debugLogger; protected final CombineDebugLogger debugLogger;
protected final DefaultErrorHandler errorHandler;
protected final Timings timings; protected final Timings timings;
protected final RunnableFactory runnableFactory; protected final RunnableFactory runnableFactory;
private final Map<String, CommandNode> commands; private final Map<String, CommandNode> commands;
@ -82,7 +79,6 @@ public class NukkitPlugin extends PluginBase implements APFPlugin {
this::getDebugLogger, this::getDebugLogger,
this::getLogger this::getLogger
); );
this.errorHandler = new DefaultErrorHandler(this, logger, new File(getDataFolder(), "logs"));
commands = new HashMap<>(); commands = new HashMap<>();
} }
@ -153,8 +149,9 @@ public class NukkitPlugin extends PluginBase implements APFPlugin {
} }
@Override @Override
@Deprecated
public ErrorHandler getErrorHandler() { public ErrorHandler getErrorHandler() {
return errorHandler; return null;
} }
@Override @Override
@ -168,9 +165,7 @@ public class NukkitPlugin extends PluginBase implements APFPlugin {
} }
@Override @Override
public void setErrorHandlers(ErrorHandler... errorHandlers) { public void setErrorHandlers(ErrorHandler... errorHandlers) { }
errorHandler.setErrorHandlers(errorHandlers);
}
@Override @Override
public void onReload() { public void onReload() {

View File

@ -21,8 +21,8 @@ import cn.nukkit.event.player.PlayerMoveEvent;
import com.djrapitops.plan.gathering.listeners.nukkit.NukkitAFKListener; import com.djrapitops.plan.gathering.listeners.nukkit.NukkitAFKListener;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.TimeSettings; import com.djrapitops.plan.settings.config.paths.TimeSettings;
import com.djrapitops.plugin.logging.console.TestPluginLogger; import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.error.ConsoleErrorLogger; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -43,12 +43,19 @@ import static org.mockito.Mockito.*;
public class NukkitAFKListenerTest { public class NukkitAFKListenerTest {
private static NukkitAFKListener underTest; private static NukkitAFKListener underTest;
private static ErrorLogger errorLogger;
@BeforeAll @BeforeAll
static void setUp() { static void setUp() {
PlanConfig config = Mockito.mock(PlanConfig.class); PlanConfig config = Mockito.mock(PlanConfig.class);
when(config.get(TimeSettings.AFK_THRESHOLD)).thenReturn(TimeUnit.MINUTES.toMillis(3)); when(config.get(TimeSettings.AFK_THRESHOLD)).thenReturn(TimeUnit.MINUTES.toMillis(3));
underTest = new NukkitAFKListener(config, new ConsoleErrorLogger(new TestPluginLogger())); errorLogger = Mockito.mock(ErrorLogger.class);
underTest = new NukkitAFKListener(config, errorLogger);
}
@AfterEach
void ensureNoErrors() {
verifyNoInteractions(errorLogger);
} }
@Test @Test

View File

@ -8,6 +8,7 @@ blossom {
} }
dependencies { dependencies {
compileOnly project(":common")
compile project(path: ":common", configuration: 'shadow') compile project(path: ":common", configuration: 'shadow')
compileOnly project(":api") compileOnly project(":api")

View File

@ -19,8 +19,8 @@ package com.djrapitops.plan;
import com.djrapitops.plan.gathering.ServerShutdownSave; import com.djrapitops.plan.gathering.ServerShutdownSave;
import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.spongepowered.api.GameState; import org.spongepowered.api.GameState;
import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order; import org.spongepowered.api.event.Order;
@ -44,9 +44,9 @@ public class SpongeServerShutdownSave extends ServerShutdownSave {
Locale locale, Locale locale,
DBSystem dbSystem, DBSystem dbSystem,
PluginLogger logger, PluginLogger logger,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
super(locale, dbSystem, logger, errorHandler); super(locale, dbSystem, logger, errorLogger);
} }
@Override @Override

View File

@ -36,8 +36,8 @@ import com.djrapitops.plan.settings.config.paths.ExportSettings;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.transactions.events.*; import com.djrapitops.plan.storage.database.transactions.events.*;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.spongepowered.api.Sponge; import org.spongepowered.api.Sponge;
import org.spongepowered.api.data.key.Keys; import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
@ -72,7 +72,7 @@ public class PlayerOnlineListener {
private final NicknameCache nicknameCache; private final NicknameCache nicknameCache;
private final SessionCache sessionCache; private final SessionCache sessionCache;
private final Status status; private final Status status;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public PlayerOnlineListener( public PlayerOnlineListener(
@ -85,7 +85,7 @@ public class PlayerOnlineListener {
NicknameCache nicknameCache, NicknameCache nicknameCache,
SessionCache sessionCache, SessionCache sessionCache,
Status status, Status status,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.config = config; this.config = config;
this.processing = processing; this.processing = processing;
@ -97,7 +97,7 @@ public class PlayerOnlineListener {
this.nicknameCache = nicknameCache; this.nicknameCache = nicknameCache;
this.sessionCache = sessionCache; this.sessionCache = sessionCache;
this.status = status; this.status = status;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Listener(order = Order.POST) @Listener(order = Order.POST)
@ -105,7 +105,7 @@ public class PlayerOnlineListener {
try { try {
actOnLoginEvent(event); actOnLoginEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }
@ -125,7 +125,7 @@ public class PlayerOnlineListener {
} }
dbSystem.getDatabase().executeTransaction(new KickStoreTransaction(playerUUID)); dbSystem.getDatabase().executeTransaction(new KickStoreTransaction(playerUUID));
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }
@ -143,7 +143,7 @@ public class PlayerOnlineListener {
try { try {
actOnJoinEvent(event); actOnJoinEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }
@ -208,7 +208,7 @@ public class PlayerOnlineListener {
try { try {
actOnQuitEvent(event); actOnQuitEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -19,8 +19,8 @@ package com.djrapitops.plan.gathering.listeners.sponge;
import com.djrapitops.plan.gathering.afk.AFKTracker; import com.djrapitops.plan.gathering.afk.AFKTracker;
import com.djrapitops.plan.settings.Permissions; import com.djrapitops.plan.settings.Permissions;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order; import org.spongepowered.api.event.Order;
@ -51,11 +51,11 @@ public class SpongeAFKListener {
static AFKTracker AFK_TRACKER; static AFKTracker AFK_TRACKER;
private final Map<UUID, Boolean> ignorePermissionInfo; private final Map<UUID, Boolean> ignorePermissionInfo;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public SpongeAFKListener(PlanConfig config, ErrorHandler errorHandler) { public SpongeAFKListener(PlanConfig config, ErrorLogger errorLogger) {
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
this.ignorePermissionInfo = new HashMap<>(); this.ignorePermissionInfo = new HashMap<>();
SpongeAFKListener.assignAFKTracker(config); SpongeAFKListener.assignAFKTracker(config);
@ -71,7 +71,7 @@ public class SpongeAFKListener {
try { try {
performedAction(event.getTargetEntity()); performedAction(event.getTargetEntity());
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -21,8 +21,8 @@ import com.djrapitops.plan.gathering.cache.NicknameCache;
import com.djrapitops.plan.identification.ServerInfo; import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.transactions.events.NicknameStoreTransaction; import com.djrapitops.plan.storage.database.transactions.events.NicknameStoreTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order; import org.spongepowered.api.event.Order;
@ -42,19 +42,19 @@ public class SpongeChatListener {
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private final NicknameCache nicknameCache; private final NicknameCache nicknameCache;
private ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public SpongeChatListener( public SpongeChatListener(
ServerInfo serverInfo, ServerInfo serverInfo,
DBSystem dbSystem, DBSystem dbSystem,
NicknameCache nicknameCache, NicknameCache nicknameCache,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.nicknameCache = nicknameCache; this.nicknameCache = nicknameCache;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Listener(order = Order.POST) @Listener(order = Order.POST)
@ -66,7 +66,7 @@ public class SpongeChatListener {
try { try {
actOnChatEvent(player); actOnChatEvent(player);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -23,8 +23,8 @@ import com.djrapitops.plan.gathering.domain.Session;
import com.djrapitops.plan.processing.Processing; import com.djrapitops.plan.processing.Processing;
import com.djrapitops.plan.processing.processors.player.MobKillProcessor; import com.djrapitops.plan.processing.processors.player.MobKillProcessor;
import com.djrapitops.plan.processing.processors.player.PlayerKillProcessor; import com.djrapitops.plan.processing.processors.player.PlayerKillProcessor;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.spongepowered.api.data.key.Keys; import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.data.type.HandTypes; import org.spongepowered.api.data.type.HandTypes;
import org.spongepowered.api.entity.Entity; import org.spongepowered.api.entity.Entity;
@ -52,15 +52,15 @@ import java.util.UUID;
public class SpongeDeathListener { public class SpongeDeathListener {
private final Processing processing; private final Processing processing;
private ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public SpongeDeathListener( public SpongeDeathListener(
Processing processing, Processing processing,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.processing = processing; this.processing = processing;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Listener @Listener
@ -81,7 +81,7 @@ public class SpongeDeathListener {
handleKill(time, dead, killerEntity); handleKill(time, dead, killerEntity);
} }
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -22,8 +22,8 @@ import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.settings.config.WorldAliasSettings; import com.djrapitops.plan.settings.config.WorldAliasSettings;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction; import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order; import org.spongepowered.api.event.Order;
@ -43,19 +43,19 @@ public class SpongeGMChangeListener {
private final WorldAliasSettings worldAliasSettings; private final WorldAliasSettings worldAliasSettings;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public SpongeGMChangeListener( public SpongeGMChangeListener(
WorldAliasSettings worldAliasSettings, WorldAliasSettings worldAliasSettings,
ServerInfo serverInfo, ServerInfo serverInfo,
DBSystem dbSystem, DBSystem dbSystem,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.worldAliasSettings = worldAliasSettings; this.worldAliasSettings = worldAliasSettings;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Listener(order = Order.POST) @Listener(order = Order.POST)
@ -67,7 +67,7 @@ public class SpongeGMChangeListener {
try { try {
actOnGMChangeEvent(event); actOnGMChangeEvent(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -22,8 +22,8 @@ import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.settings.config.WorldAliasSettings; import com.djrapitops.plan.settings.config.WorldAliasSettings;
import com.djrapitops.plan.storage.database.DBSystem; import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction; import com.djrapitops.plan.storage.database.transactions.events.WorldNameStoreTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import org.spongepowered.api.data.key.Keys; import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.entity.living.player.gamemode.GameMode; import org.spongepowered.api.entity.living.player.gamemode.GameMode;
@ -46,19 +46,19 @@ public class SpongeWorldChangeListener {
private final WorldAliasSettings worldAliasSettings; private final WorldAliasSettings worldAliasSettings;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final DBSystem dbSystem; private final DBSystem dbSystem;
private ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public SpongeWorldChangeListener( public SpongeWorldChangeListener(
WorldAliasSettings worldAliasSettings, WorldAliasSettings worldAliasSettings,
ServerInfo serverInfo, ServerInfo serverInfo,
DBSystem dbSystem, DBSystem dbSystem,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.worldAliasSettings = worldAliasSettings; this.worldAliasSettings = worldAliasSettings;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.dbSystem = dbSystem; this.dbSystem = dbSystem;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Listener(order = Order.POST) @Listener(order = Order.POST)
@ -70,7 +70,7 @@ public class SpongeWorldChangeListener {
try { try {
actOnEvent(event, player); actOnEvent(event, player);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.ERROR, this.getClass(), e); errorLogger.log(L.ERROR, this.getClass(), e);
} }
} }

View File

@ -20,9 +20,7 @@ import com.djrapitops.plan.exceptions.EnableException;
import com.djrapitops.plan.settings.config.PlanConfig; import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.DatabaseSettings; import com.djrapitops.plan.settings.config.paths.DatabaseSettings;
import com.djrapitops.plan.settings.locale.Locale; import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plugin.benchmarking.Timings;
import com.djrapitops.plugin.logging.console.PluginLogger; import com.djrapitops.plugin.logging.console.PluginLogger;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -44,9 +42,7 @@ public class SpongeDBSystem extends DBSystem {
SQLiteDB.Factory sqLiteDB, SQLiteDB.Factory sqLiteDB,
H2DB.Factory h2DB, H2DB.Factory h2DB,
PlanConfig config, PlanConfig config,
PluginLogger logger, PluginLogger logger
Timings timings,
ErrorHandler errorHandler
) { ) {
super(locale, sqLiteDB, h2DB, logger); super(locale, sqLiteDB, h2DB, logger);
this.config = config; this.config = config;

View File

@ -8,6 +8,7 @@ blossom {
} }
dependencies { dependencies {
compileOnly project(":common")
compile project(path: ":common", configuration: 'shadow') compile project(path: ":common", configuration: 'shadow')
compileOnly project(":api") compileOnly project(":api")

View File

@ -34,8 +34,8 @@ import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database; import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.storage.database.transactions.events.GeoInfoStoreTransaction; import com.djrapitops.plan.storage.database.transactions.events.GeoInfoStoreTransaction;
import com.djrapitops.plan.storage.database.transactions.events.PlayerRegisterTransaction; import com.djrapitops.plan.storage.database.transactions.events.PlayerRegisterTransaction;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L; import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.velocitypowered.api.event.PostOrder; import com.velocitypowered.api.event.PostOrder;
import com.velocitypowered.api.event.Subscribe; import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.connection.DisconnectEvent; import com.velocitypowered.api.event.connection.DisconnectEvent;
@ -66,7 +66,7 @@ public class PlayerOnlineListener {
private final GeolocationCache geolocationCache; private final GeolocationCache geolocationCache;
private final SessionCache sessionCache; private final SessionCache sessionCache;
private final ServerInfo serverInfo; private final ServerInfo serverInfo;
private final ErrorHandler errorHandler; private final ErrorLogger errorLogger;
@Inject @Inject
public PlayerOnlineListener( public PlayerOnlineListener(
@ -74,10 +74,11 @@ public class PlayerOnlineListener {
Processing processing, Processing processing,
DBSystem dbSystem, DBSystem dbSystem,
ExtensionSvc extensionService, ExtensionSvc extensionService,
Exporter exporter, GeolocationCache geolocationCache, Exporter exporter,
GeolocationCache geolocationCache,
SessionCache sessionCache, SessionCache sessionCache,
ServerInfo serverInfo, ServerInfo serverInfo,
ErrorHandler errorHandler ErrorLogger errorLogger
) { ) {
this.config = config; this.config = config;
this.processing = processing; this.processing = processing;
@ -87,7 +88,7 @@ public class PlayerOnlineListener {
this.geolocationCache = geolocationCache; this.geolocationCache = geolocationCache;
this.sessionCache = sessionCache; this.sessionCache = sessionCache;
this.serverInfo = serverInfo; this.serverInfo = serverInfo;
this.errorHandler = errorHandler; this.errorLogger = errorLogger;
} }
@Subscribe(order = PostOrder.LAST) @Subscribe(order = PostOrder.LAST)
@ -95,7 +96,7 @@ public class PlayerOnlineListener {
try { try {
actOnLogin(event); actOnLogin(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }
@ -146,7 +147,7 @@ public class PlayerOnlineListener {
try { try {
actOnLogout(event); actOnLogout(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }
@ -184,7 +185,7 @@ public class PlayerOnlineListener {
try { try {
actOnServerSwitch(event); actOnServerSwitch(event);
} catch (Exception e) { } catch (Exception e) {
errorHandler.log(L.WARN, this.getClass(), e); errorLogger.log(L.WARN, this.getClass(), e);
} }
} }