mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-16 13:11:28 +01:00
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:
parent
d09a4016d3
commit
e53b9f1602
@ -5,6 +5,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly project(":common")
|
||||
compile project(path: ":common", configuration: 'shadow')
|
||||
compileOnly project(":api")
|
||||
|
||||
|
@ -20,8 +20,8 @@ import com.djrapitops.plan.gathering.ServerShutdownSave;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -39,9 +39,9 @@ public class BukkitServerShutdownSave extends ServerShutdownSave {
|
||||
Locale locale,
|
||||
DBSystem dbSystem,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super(locale, dbSystem, logger, errorHandler);
|
||||
super(locale, dbSystem, logger, errorLogger);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,7 +18,7 @@ package com.djrapitops.plan.addons.placeholderapi;
|
||||
|
||||
import com.djrapitops.plan.PlanSystem;
|
||||
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.Singleton;
|
||||
@ -28,20 +28,20 @@ public class BukkitPlaceholderRegistrar {
|
||||
|
||||
private final PlanPlaceholders placeholders;
|
||||
private final PlanSystem system;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public BukkitPlaceholderRegistrar(
|
||||
PlanPlaceholders placeholders,
|
||||
PlanSystem system,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.placeholders = placeholders;
|
||||
this.system = system;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
public void register() {
|
||||
new PlanPlaceholderExtension(placeholders, system, errorHandler).register();
|
||||
new PlanPlaceholderExtension(placeholders, system, errorLogger).register();
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ package com.djrapitops.plan.addons.placeholderapi;
|
||||
|
||||
import com.djrapitops.plan.PlanSystem;
|
||||
import com.djrapitops.plan.placeholder.PlanPlaceholders;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plan.version.VersionChecker;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -34,18 +34,18 @@ import java.util.Collections;
|
||||
*/
|
||||
public class PlanPlaceholderExtension extends PlaceholderExpansion {
|
||||
|
||||
public final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
private final VersionChecker versionChecker;
|
||||
private final PlanPlaceholders placeholders;
|
||||
|
||||
public PlanPlaceholderExtension(
|
||||
PlanPlaceholders placeholders,
|
||||
PlanSystem system,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.placeholders = placeholders;
|
||||
this.versionChecker = system.getVersionChecker();
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,7 +92,7 @@ public class PlanPlaceholderExtension extends PlaceholderExpansion {
|
||||
|
||||
return value;
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.WARN, getClass(), e);
|
||||
errorLogger.log(L.WARN, getClass(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ package com.djrapitops.plan.gathering.listeners.bukkit;
|
||||
import com.djrapitops.plan.gathering.afk.AFKTracker;
|
||||
import com.djrapitops.plan.settings.Permissions;
|
||||
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.error.ErrorHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -46,11 +46,11 @@ public class BukkitAFKListener implements Listener {
|
||||
static AFKTracker AFK_TRACKER;
|
||||
|
||||
private final Map<UUID, Boolean> ignorePermissionInfo;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public BukkitAFKListener(PlanConfig config, ErrorHandler errorHandler) {
|
||||
this.errorHandler = errorHandler;
|
||||
public BukkitAFKListener(PlanConfig config, ErrorLogger errorLogger) {
|
||||
this.errorLogger = errorLogger;
|
||||
this.ignorePermissionInfo = new HashMap<>();
|
||||
|
||||
BukkitAFKListener.assignAFKTracker(config);
|
||||
@ -79,7 +79,7 @@ public class BukkitAFKListener implements Listener {
|
||||
|
||||
AFK_TRACKER.performedAction(uuid, time);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ import com.djrapitops.plan.gathering.cache.NicknameCache;
|
||||
import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
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.error.ErrorHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -42,19 +42,19 @@ public class ChatListener implements Listener {
|
||||
private final ServerInfo serverInfo;
|
||||
private final DBSystem dbSystem;
|
||||
private final NicknameCache nicknameCache;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public ChatListener(
|
||||
ServerInfo serverInfo,
|
||||
DBSystem dbSystem,
|
||||
NicknameCache nicknameCache,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.serverInfo = serverInfo;
|
||||
this.dbSystem = dbSystem;
|
||||
this.nicknameCache = nicknameCache;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -66,7 +66,7 @@ public class ChatListener implements Listener {
|
||||
try {
|
||||
actOnChatEvent(event);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,8 @@ import com.djrapitops.plan.gathering.domain.Session;
|
||||
import com.djrapitops.plan.processing.Processing;
|
||||
import com.djrapitops.plan.processing.processors.player.MobKillProcessor;
|
||||
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.error.ErrorHandler;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -46,15 +46,15 @@ import java.util.UUID;
|
||||
public class DeathEventListener implements Listener {
|
||||
|
||||
private final Processing processing;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public DeathEventListener(
|
||||
Processing processing,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.processing = processing;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -80,7 +80,7 @@ public class DeathEventListener implements Listener {
|
||||
UUID uuid = dead instanceof Player ? dead.getUniqueId() : null;
|
||||
handleKill(time, uuid, killerEntity);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,8 @@ import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.settings.config.WorldAliasSettings;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
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.error.ErrorHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -44,19 +44,19 @@ public class GameModeChangeListener implements Listener {
|
||||
private final WorldAliasSettings worldAliasSettings;
|
||||
private final ServerInfo serverInfo;
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public GameModeChangeListener(
|
||||
WorldAliasSettings worldAliasSettings,
|
||||
ServerInfo serverInfo,
|
||||
DBSystem dbSystem,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.worldAliasSettings = worldAliasSettings;
|
||||
this.serverInfo = serverInfo;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -67,7 +67,7 @@ public class GameModeChangeListener implements Listener {
|
||||
try {
|
||||
actOnEvent(event);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.Database;
|
||||
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.error.ErrorHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -67,7 +67,7 @@ public class PlayerOnlineListener implements Listener {
|
||||
private final GeolocationCache geolocationCache;
|
||||
private final NicknameCache nicknameCache;
|
||||
private final SessionCache sessionCache;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
private final Status status;
|
||||
|
||||
@Inject
|
||||
@ -82,7 +82,7 @@ public class PlayerOnlineListener implements Listener {
|
||||
NicknameCache nicknameCache,
|
||||
SessionCache sessionCache,
|
||||
Status status,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.config = config;
|
||||
this.processing = processing;
|
||||
@ -94,7 +94,7 @@ public class PlayerOnlineListener implements Listener {
|
||||
this.nicknameCache = nicknameCache;
|
||||
this.sessionCache = sessionCache;
|
||||
this.status = status;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -107,7 +107,7 @@ public class PlayerOnlineListener implements Listener {
|
||||
dbSystem.getDatabase().executeTransaction(new BanStatusTransaction(playerUUID, () -> banned));
|
||||
dbSystem.getDatabase().executeTransaction(new OperatorStatusTransaction(playerUUID, operator));
|
||||
} 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));
|
||||
} 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 {
|
||||
actOnJoinEvent(event);
|
||||
} 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 {
|
||||
actOnQuitEvent(event);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,8 @@ import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.settings.config.WorldAliasSettings;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
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.error.ErrorHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -39,19 +39,19 @@ public class WorldChangeListener implements Listener {
|
||||
private final WorldAliasSettings worldAliasSettings;
|
||||
private final ServerInfo serverInfo;
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public WorldChangeListener(
|
||||
WorldAliasSettings worldAliasSettings,
|
||||
ServerInfo serverInfo,
|
||||
DBSystem dbSystem,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.worldAliasSettings = worldAliasSettings;
|
||||
this.serverInfo = serverInfo;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -59,7 +59,7 @@ public class WorldChangeListener implements Listener {
|
||||
try {
|
||||
actOnEvent(event);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,10 +19,10 @@ package com.djrapitops.plan.gathering.listeners;
|
||||
import com.djrapitops.plan.gathering.listeners.bukkit.BukkitAFKListener;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.settings.config.paths.TimeSettings;
|
||||
import com.djrapitops.plugin.logging.console.TestPluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ConsoleErrorLogger;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
@ -43,12 +43,19 @@ import static org.mockito.Mockito.*;
|
||||
public class BukkitAFKListenerTest {
|
||||
|
||||
private static BukkitAFKListener underTest;
|
||||
private static ErrorLogger errorLogger;
|
||||
|
||||
@BeforeAll
|
||||
static void setUp() {
|
||||
PlanConfig config = Mockito.mock(PlanConfig.class);
|
||||
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
|
||||
|
@ -1,4 +1,5 @@
|
||||
dependencies {
|
||||
compileOnly project(":common")
|
||||
compile project(path: ":common", configuration: 'shadow')
|
||||
compileOnly project(":api")
|
||||
|
||||
|
@ -34,8 +34,8 @@ import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.transactions.events.GeoInfoStoreTransaction;
|
||||
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.error.ErrorHandler;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
@ -63,7 +63,7 @@ public class PlayerOnlineListener implements Listener {
|
||||
private final GeolocationCache geolocationCache;
|
||||
private final SessionCache sessionCache;
|
||||
private final ServerInfo serverInfo;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public PlayerOnlineListener(
|
||||
@ -74,7 +74,7 @@ public class PlayerOnlineListener implements Listener {
|
||||
Exporter exporter, GeolocationCache geolocationCache,
|
||||
SessionCache sessionCache,
|
||||
ServerInfo serverInfo,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.config = config;
|
||||
this.processing = processing;
|
||||
@ -84,7 +84,7 @@ public class PlayerOnlineListener implements Listener {
|
||||
this.geolocationCache = geolocationCache;
|
||||
this.sessionCache = sessionCache;
|
||||
this.serverInfo = serverInfo;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@ -92,7 +92,7 @@ public class PlayerOnlineListener implements Listener {
|
||||
try {
|
||||
actOnLogin(event);
|
||||
} 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 {
|
||||
actOnLogout(event);
|
||||
} 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 {
|
||||
actOnServerSwitch(event);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.WARN, this.getClass(), e);
|
||||
errorLogger.log(L.WARN, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,12 +37,12 @@ import com.djrapitops.plan.settings.SettingsSvc;
|
||||
import com.djrapitops.plan.settings.locale.LocaleSystem;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.file.PlanFiles;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plan.version.VersionChecker;
|
||||
import com.djrapitops.plugin.benchmarking.Benchmark;
|
||||
import com.djrapitops.plugin.benchmarking.Timings;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -82,7 +82,7 @@ public class PlanSystem implements SubSystem {
|
||||
private final SettingsSvc settingsService;
|
||||
private final PluginLogger logger;
|
||||
private final Timings timings;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public PlanSystem(
|
||||
@ -107,7 +107,7 @@ public class PlanSystem implements SubSystem {
|
||||
SettingsSvc settingsService,
|
||||
PluginLogger logger,
|
||||
Timings timings,
|
||||
ErrorHandler errorHandler,
|
||||
ErrorLogger errorLogger,
|
||||
PlanAPI.PlanAPIHolder apiHolder
|
||||
) {
|
||||
this.files = files;
|
||||
@ -131,7 +131,7 @@ public class PlanSystem implements SubSystem {
|
||||
this.settingsService = settingsService;
|
||||
this.logger = logger;
|
||||
this.timings = timings;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
logger.log(L.INFO_COLOR,
|
||||
"",
|
||||
@ -175,7 +175,7 @@ public class PlanSystem implements SubSystem {
|
||||
// Disables Webserver if Proxy is detected in the database
|
||||
if (serverInfo.getServer().isNotProxy()) {
|
||||
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();
|
||||
}
|
||||
} 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() {
|
||||
return extensionService;
|
||||
}
|
||||
|
||||
public ErrorLogger getErrorLogger() {
|
||||
return errorLogger;
|
||||
}
|
||||
}
|
@ -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.objects.ServerQueries;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -51,19 +51,19 @@ public class CommonAPI implements PlanAPI {
|
||||
private final DBSystem dbSystem;
|
||||
private final UUIDUtility uuidUtility;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public CommonAPI(
|
||||
DBSystem dbSystem,
|
||||
UUIDUtility uuidUtility,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.dbSystem = dbSystem;
|
||||
this.uuidUtility = uuidUtility;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
PlanAPIHolder.set(this);
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public class CommonAPI implements PlanAPI {
|
||||
try {
|
||||
return queryDB(UserIdentifierQueries.fetchAllPlayerNames());
|
||||
} catch (DBOpException e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
return new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ import com.djrapitops.plan.api.data.ServerContainer;
|
||||
import com.djrapitops.plan.data.plugin.PluginData;
|
||||
import com.djrapitops.plan.identification.UUIDUtility;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -58,9 +58,9 @@ public interface PlanAPI {
|
||||
DBSystem dbSystem,
|
||||
UUIDUtility uuidUtility,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
set(new CommonAPI(dbSystem, uuidUtility, logger, errorHandler));
|
||||
set(new CommonAPI(dbSystem, uuidUtility, logger, errorLogger));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,12 +34,12 @@ import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
|
||||
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.CommandType;
|
||||
import com.djrapitops.plugin.command.CommandUtils;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -60,7 +60,7 @@ public class AnalyzeCommand extends CommandNode {
|
||||
private final ServerInfo serverInfo;
|
||||
private final WebServer webServer;
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public AnalyzeCommand(
|
||||
@ -71,7 +71,7 @@ public class AnalyzeCommand extends CommandNode {
|
||||
ServerInfo serverInfo,
|
||||
WebServer webServer,
|
||||
DBSystem dbSystem,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("analyze|analyse|analysis|a", Permissions.ANALYZE.getPermission(), CommandType.CONSOLE);
|
||||
|
||||
@ -82,7 +82,7 @@ public class AnalyzeCommand extends CommandNode {
|
||||
this.serverInfo = serverInfo;
|
||||
this.webServer = webServer;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setShortHelp(locale.getString(CmdHelpLang.ANALYZE));
|
||||
setInDepthHelp(locale.getArray(DeepHelpLang.ANALYZE));
|
||||
@ -106,7 +106,7 @@ public class AnalyzeCommand extends CommandNode {
|
||||
sendLink(server, sender);
|
||||
} catch (DBOpException | ExportException e) {
|
||||
sender.sendMessage("§cError occurred: " + e.toString());
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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.objects.WebUserQueries;
|
||||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.CommandUtils;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.UUID;
|
||||
@ -55,7 +55,7 @@ public class InspectCommand extends CommandNode {
|
||||
private final Addresses addresses;
|
||||
private final Processing processing;
|
||||
private final UUIDUtility uuidUtility;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public InspectCommand(
|
||||
@ -65,7 +65,7 @@ public class InspectCommand extends CommandNode {
|
||||
DBSystem dbSystem,
|
||||
WebServer webServer,
|
||||
UUIDUtility uuidUtility,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("inspect", Permissions.INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
this.addresses = addresses;
|
||||
@ -76,7 +76,7 @@ public class InspectCommand extends CommandNode {
|
||||
this.dbSystem = dbSystem;
|
||||
this.webServer = webServer;
|
||||
this.uuidUtility = uuidUtility;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setShortHelp(locale.getString(CmdHelpLang.INSPECT));
|
||||
setInDepthHelp(locale.getArray(DeepHelpLang.INSPECT));
|
||||
@ -117,7 +117,7 @@ public class InspectCommand extends CommandNode {
|
||||
this.sendInspectMsg(sender, playerName);
|
||||
} catch (DBOpException e) {
|
||||
sender.sendMessage("§eDatabase exception occurred: " + e.getMessage());
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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.Database;
|
||||
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.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
@ -49,21 +49,21 @@ public class ListServersCommand extends CommandNode {
|
||||
private final Locale locale;
|
||||
private final ColorScheme colorScheme;
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public ListServersCommand(
|
||||
Locale locale,
|
||||
ColorScheme colorScheme,
|
||||
DBSystem dbSystem,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("servers|serverlist|listservers|sl|ls", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
|
||||
|
||||
this.locale = locale;
|
||||
this.colorScheme = colorScheme;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setShortHelp(locale.getString(CmdHelpLang.SERVERS));
|
||||
setInDepthHelp(locale.getArray(DeepHelpLang.SERVERS));
|
||||
@ -86,7 +86,7 @@ public class ListServersCommand extends CommandNode {
|
||||
sender.sendMessage(">");
|
||||
} catch (DBOpException e) {
|
||||
sender.sendMessage("§cDatabase Exception occurred.");
|
||||
errorHandler.log(L.WARN, this.getClass(), e);
|
||||
errorLogger.log(L.WARN, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,11 +40,11 @@ import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries;
|
||||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -67,7 +67,7 @@ public class QInspectCommand extends CommandNode {
|
||||
private final Processing processing;
|
||||
private final Formatters formatters;
|
||||
private final UUIDUtility uuidUtility;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public QInspectCommand(
|
||||
@ -77,7 +77,7 @@ public class QInspectCommand extends CommandNode {
|
||||
DBSystem dbSystem,
|
||||
UUIDUtility uuidUtility,
|
||||
Formatters formatters,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("qinspect", Permissions.QUICK_INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
this.config = config;
|
||||
@ -88,7 +88,7 @@ public class QInspectCommand extends CommandNode {
|
||||
this.locale = locale;
|
||||
this.dbSystem = dbSystem;
|
||||
this.uuidUtility = uuidUtility;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setShortHelp(locale.getString(CmdHelpLang.QINSPECT));
|
||||
setInDepthHelp(locale.getArray(DeepHelpLang.QINSPECT));
|
||||
@ -130,7 +130,7 @@ public class QInspectCommand extends CommandNode {
|
||||
sendMessages(sender, container);
|
||||
} catch (DBOpException e) {
|
||||
sender.sendMessage("§eDatabase exception occurred: " + e.getMessage());
|
||||
errorHandler.log(L.WARN, this.getClass(), e);
|
||||
errorLogger.log(L.WARN, this.getClass(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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.transactions.commands.RegisterWebUserTransaction;
|
||||
import com.djrapitops.plan.utilities.PassEncryptUtil;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.CommandUtils;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -70,7 +70,7 @@ public class RegisterCommand extends CommandNode {
|
||||
private final UUIDUtility uuidUtility;
|
||||
private final Addresses addresses;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public RegisterCommand(
|
||||
@ -80,7 +80,7 @@ public class RegisterCommand extends CommandNode {
|
||||
DBSystem dbSystem,
|
||||
UUIDUtility uuidUtility,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
// No Permission Requirement
|
||||
super("register", "", CommandType.ALL);
|
||||
@ -91,7 +91,7 @@ public class RegisterCommand extends CommandNode {
|
||||
this.uuidUtility = uuidUtility;
|
||||
this.logger = logger;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setArguments("<password>", "[name]", "[lvl]");
|
||||
setShortHelp(locale.getString(CmdHelpLang.WEB_REGISTER));
|
||||
@ -128,14 +128,14 @@ public class RegisterCommand extends CommandNode {
|
||||
registerUsingLegacy(sender, arguments);
|
||||
}
|
||||
} catch (PassEncryptUtil.CannotPerformOperationException e) {
|
||||
errorHandler.log(L.WARN, this.getClass(), e);
|
||||
errorLogger.log(L.WARN, this.getClass(), e);
|
||||
sender.sendMessage("§cPassword hash error.");
|
||||
} catch (NumberFormatException e) {
|
||||
throw new NumberFormatException(args[2]);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw 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) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (DBOpException | ExecutionException e) {
|
||||
errorHandler.log(L.WARN, this.getClass(), e);
|
||||
errorLogger.log(L.WARN, this.getClass(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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.CommandLang;
|
||||
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.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@ -39,15 +39,15 @@ public class ReloadCommand extends CommandNode {
|
||||
|
||||
private final PlanPlugin plugin;
|
||||
private final Locale locale;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public ReloadCommand(PlanPlugin plugin, Locale locale, ErrorHandler errorHandler) {
|
||||
public ReloadCommand(PlanPlugin plugin, Locale locale, ErrorLogger errorLogger) {
|
||||
super("reload", Permissions.RELOAD.getPermission(), CommandType.CONSOLE);
|
||||
|
||||
this.plugin = plugin;
|
||||
this.locale = locale;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setShortHelp(locale.getString(CmdHelpLang.RELOAD));
|
||||
setInDepthHelp(locale.getArray(DeepHelpLang.RELOAD));
|
||||
@ -60,7 +60,7 @@ public class ReloadCommand extends CommandNode {
|
||||
plugin.reloadPlugin(true);
|
||||
sender.sendMessage(locale.getString(CommandLang.RELOAD_COMPLETE));
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.CRITICAL, this.getClass(), e);
|
||||
errorLogger.log(L.CRITICAL, this.getClass(), e);
|
||||
sender.sendMessage(locale.getString(CommandLang.RELOAD_FAILED));
|
||||
} finally {
|
||||
Thread thread = Thread.currentThread();
|
||||
|
@ -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.Database;
|
||||
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.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -51,20 +51,20 @@ public class SearchCommand extends CommandNode {
|
||||
private final Locale locale;
|
||||
private final Processing processing;
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public SearchCommand(
|
||||
Locale locale,
|
||||
Processing processing,
|
||||
DBSystem dbSystem,
|
||||
ErrorHandler errorHandler) {
|
||||
ErrorLogger errorLogger) {
|
||||
super("search", Permissions.SEARCH.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
|
||||
this.locale = locale;
|
||||
this.processing = processing;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setArguments("<text>");
|
||||
setShortHelp(locale.getString(CmdHelpLang.SEARCH));
|
||||
@ -105,7 +105,7 @@ public class SearchCommand extends CommandNode {
|
||||
sender.sendMessage(">");
|
||||
} catch (DBOpException e) {
|
||||
sender.sendMessage("§cDatabase error occurred: " + e.getMessage());
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -30,12 +30,12 @@ import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries;
|
||||
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.CommandType;
|
||||
import com.djrapitops.plugin.command.CommandUtils;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -56,7 +56,7 @@ public class UnregisterCommand extends CommandNode {
|
||||
private final Processing processing;
|
||||
private final DBSystem dbSystem;
|
||||
private final UUIDUtility uuidUtility;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public UnregisterCommand(
|
||||
@ -64,7 +64,7 @@ public class UnregisterCommand extends CommandNode {
|
||||
Processing processing,
|
||||
DBSystem dbSystem,
|
||||
UUIDUtility uuidUtility,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("unregister", "", CommandType.PLAYER_OR_ARGS);
|
||||
|
||||
@ -72,7 +72,7 @@ public class UnregisterCommand extends CommandNode {
|
||||
this.processing = processing;
|
||||
this.dbSystem = dbSystem;
|
||||
this.uuidUtility = uuidUtility;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setShortHelp(locale.getString(CmdHelpLang.WEB_DELETE));
|
||||
setArguments("[username]");
|
||||
@ -125,7 +125,7 @@ public class UnregisterCommand extends CommandNode {
|
||||
.get(); // Wait for completion
|
||||
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
} 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()));
|
||||
}
|
||||
});
|
||||
|
@ -33,11 +33,11 @@ import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.SQLiteDB;
|
||||
import com.djrapitops.plan.storage.database.queries.ServerAggregateQueries;
|
||||
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.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -57,7 +57,7 @@ public class ManageBackupCommand extends CommandNode {
|
||||
private final Processing processing;
|
||||
private final DBSystem dbSystem;
|
||||
private final SQLiteDB.Factory sqliteFactory;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private final Formatter<Long> iso8601LongFormatter;
|
||||
|
||||
@ -68,7 +68,7 @@ public class ManageBackupCommand extends CommandNode {
|
||||
DBSystem dbSystem,
|
||||
SQLiteDB.Factory sqliteFactory,
|
||||
Formatters formatters,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("backup", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
|
||||
|
||||
@ -76,7 +76,7 @@ public class ManageBackupCommand extends CommandNode {
|
||||
this.processing = processing;
|
||||
this.dbSystem = dbSystem;
|
||||
this.sqliteFactory = sqliteFactory;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
this.iso8601LongFormatter = formatters.iso8601NoClockLong();
|
||||
|
||||
@ -118,7 +118,7 @@ public class ManageBackupCommand extends CommandNode {
|
||||
createNewBackup(args[0], database);
|
||||
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
} 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()));
|
||||
}
|
||||
});
|
||||
@ -143,7 +143,7 @@ public class ManageBackupCommand extends CommandNode {
|
||||
backupDB.init();
|
||||
backupDB.executeTransaction(new BackupCopyTransaction(copyFromDB, backupDB)).get();
|
||||
} catch (DBOpException | ExecutionException e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
} catch (InterruptedException e) {
|
||||
backupDB.close();
|
||||
Thread.currentThread().interrupt();
|
||||
|
@ -31,11 +31,11 @@ import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.DBType;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
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.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -56,7 +56,7 @@ public class ManageClearCommand extends CommandNode {
|
||||
private final Processing processing;
|
||||
private final DBSystem dbSystem;
|
||||
private final QuerySvc queryService;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public ManageClearCommand(
|
||||
@ -65,7 +65,7 @@ public class ManageClearCommand extends CommandNode {
|
||||
Processing processing,
|
||||
DBSystem dbSystem,
|
||||
QuerySvc queryService,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("clear", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
this.plugin = plugin;
|
||||
@ -74,7 +74,7 @@ public class ManageClearCommand extends CommandNode {
|
||||
this.processing = processing;
|
||||
this.dbSystem = dbSystem;
|
||||
this.queryService = queryService;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setArguments("<DB>", "[-a]");
|
||||
setShortHelp(locale.getString(CmdHelpLang.MANAGE_CLEAR));
|
||||
@ -119,7 +119,7 @@ public class ManageClearCommand extends CommandNode {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (DBOpException | ExecutionException e) {
|
||||
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 {
|
||||
plugin.reloadPlugin(true);
|
||||
} 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_COMPLETE));
|
||||
|
@ -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.DBType;
|
||||
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.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -50,17 +50,17 @@ public class ManageHotSwapCommand extends CommandNode {
|
||||
private final Locale locale;
|
||||
private final DBSystem dbSystem;
|
||||
private final PlanConfig config;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@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);
|
||||
|
||||
this.plugin = plugin;
|
||||
this.locale = locale;
|
||||
this.dbSystem = dbSystem;
|
||||
this.config = config;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setArguments("<DB>");
|
||||
setShortHelp(locale.getString(CmdHelpLang.MANAGE_HOTSWAP));
|
||||
@ -88,7 +88,7 @@ public class ManageHotSwapCommand extends CommandNode {
|
||||
return;
|
||||
}
|
||||
} 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()));
|
||||
return;
|
||||
}
|
||||
@ -97,7 +97,7 @@ public class ManageHotSwapCommand extends CommandNode {
|
||||
config.set(DatabaseSettings.TYPE, dbName);
|
||||
config.save();
|
||||
} catch (IOException e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
return;
|
||||
}
|
||||
plugin.reloadPlugin(true);
|
||||
|
@ -27,11 +27,11 @@ import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.DBType;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
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.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -51,21 +51,21 @@ public class ManageMoveCommand extends CommandNode {
|
||||
private final Locale locale;
|
||||
private final Processing processing;
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public ManageMoveCommand(
|
||||
Locale locale,
|
||||
Processing processing,
|
||||
DBSystem dbSystem,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("move", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
|
||||
this.locale = locale;
|
||||
this.processing = processing;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setArguments("<fromDB>", "<toDB>", "[-a]");
|
||||
setShortHelp(locale.getString(CmdHelpLang.MANAGE_MOVE));
|
||||
@ -129,7 +129,7 @@ public class ManageMoveCommand extends CommandNode {
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} 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()));
|
||||
}
|
||||
});
|
||||
|
@ -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.transactions.commands.RemovePlayerTransaction;
|
||||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plugin.command.CommandNode;
|
||||
import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -58,7 +58,7 @@ public class ManageRemoveCommand extends CommandNode {
|
||||
private final DBSystem dbSystem;
|
||||
private final QuerySvc queryService;
|
||||
private final UUIDUtility uuidUtility;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public ManageRemoveCommand(
|
||||
@ -67,7 +67,7 @@ public class ManageRemoveCommand extends CommandNode {
|
||||
DBSystem dbSystem,
|
||||
QuerySvc queryService,
|
||||
UUIDUtility uuidUtility,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("remove|delete", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||
|
||||
@ -76,7 +76,7 @@ public class ManageRemoveCommand extends CommandNode {
|
||||
this.dbSystem = dbSystem;
|
||||
this.queryService = queryService;
|
||||
this.uuidUtility = uuidUtility;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setArguments("<player>", "[-a]");
|
||||
setShortHelp(locale.getString(CmdHelpLang.MANAGE_REMOVE));
|
||||
@ -131,7 +131,7 @@ public class ManageRemoveCommand extends CommandNode {
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} 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()));
|
||||
}
|
||||
});
|
||||
|
@ -29,11 +29,11 @@ import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.SQLiteDB;
|
||||
import com.djrapitops.plan.storage.database.transactions.BackupCopyTransaction;
|
||||
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.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -51,7 +51,7 @@ public class ManageRestoreCommand extends CommandNode {
|
||||
private final Locale locale;
|
||||
private final Processing processing;
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
private final SQLiteDB.Factory sqliteFactory;
|
||||
private final PlanFiles files;
|
||||
|
||||
@ -62,7 +62,7 @@ public class ManageRestoreCommand extends CommandNode {
|
||||
DBSystem dbSystem,
|
||||
SQLiteDB.Factory sqliteFactory,
|
||||
PlanFiles files,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("restore", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
|
||||
|
||||
@ -71,7 +71,7 @@ public class ManageRestoreCommand extends CommandNode {
|
||||
this.dbSystem = dbSystem;
|
||||
this.sqliteFactory = sqliteFactory;
|
||||
this.files = files;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setArguments("<Filename.db>", "<dbTo>", "[-a]");
|
||||
setShortHelp(locale.getString(CmdHelpLang.MANAGE_RESTORE));
|
||||
@ -135,7 +135,7 @@ public class ManageRestoreCommand extends CommandNode {
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} 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()));
|
||||
}
|
||||
});
|
||||
|
@ -30,11 +30,11 @@ import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
|
||||
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.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -52,7 +52,7 @@ public class ManageUninstalledCommand extends CommandNode {
|
||||
private final Locale locale;
|
||||
private final Processing processing;
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
private final ServerInfo serverInfo;
|
||||
|
||||
@Inject
|
||||
@ -61,7 +61,7 @@ public class ManageUninstalledCommand extends CommandNode {
|
||||
Processing processing,
|
||||
DBSystem dbSystem,
|
||||
ServerInfo serverInfo,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("uninstalled", Permissions.MANAGE.getPermission(), CommandType.ALL_WITH_ARGS);
|
||||
|
||||
@ -69,7 +69,7 @@ public class ManageUninstalledCommand extends CommandNode {
|
||||
this.processing = processing;
|
||||
this.dbSystem = dbSystem;
|
||||
this.serverInfo = serverInfo;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setShortHelp(locale.getString(CmdHelpLang.MANAGE_UNINSTALLED));
|
||||
setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_UNINSTALLED));
|
||||
@ -104,7 +104,7 @@ public class ManageUninstalledCommand extends CommandNode {
|
||||
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
} catch (DBOpException e) {
|
||||
sender.sendMessage("§cError occurred: " + e.toString());
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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.Database;
|
||||
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.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -49,21 +49,21 @@ public class WebCheckCommand extends CommandNode {
|
||||
private final Locale locale;
|
||||
private final Processing processing;
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public WebCheckCommand(
|
||||
Locale locale,
|
||||
Processing processing,
|
||||
DBSystem dbSystem,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("check", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS);
|
||||
|
||||
this.locale = locale;
|
||||
this.processing = processing;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setShortHelp(locale.getString(CmdHelpLang.WEB_CHECK));
|
||||
setArguments("<username>");
|
||||
@ -93,7 +93,7 @@ public class WebCheckCommand extends CommandNode {
|
||||
User info = found.get();
|
||||
sender.sendMessage(locale.getString(CommandLang.WEB_USER_LIST, info.getUsername(), info.getPermissionLevel()));
|
||||
} 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()));
|
||||
}
|
||||
});
|
||||
|
@ -28,11 +28,11 @@ import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries;
|
||||
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.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -51,21 +51,21 @@ public class WebDeleteCommand extends CommandNode {
|
||||
private final Locale locale;
|
||||
private final Processing processing;
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public WebDeleteCommand(
|
||||
Locale locale,
|
||||
Processing processing,
|
||||
DBSystem dbSystem,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("delete|remove", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS);
|
||||
|
||||
this.locale = locale;
|
||||
this.processing = processing;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setShortHelp(locale.getString(CmdHelpLang.WEB_DELETE));
|
||||
setArguments("<username>");
|
||||
@ -97,7 +97,7 @@ public class WebDeleteCommand extends CommandNode {
|
||||
.get(); // Wait for completion
|
||||
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
} 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()));
|
||||
}
|
||||
});
|
||||
|
@ -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.Database;
|
||||
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.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -47,21 +47,21 @@ public class WebListUsersCommand extends CommandNode {
|
||||
private final Locale locale;
|
||||
private final Processing processing;
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public WebListUsersCommand(
|
||||
Locale locale,
|
||||
Processing processing,
|
||||
DBSystem dbSystem,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super("list", Permissions.MANAGE_WEB.getPerm(), CommandType.CONSOLE);
|
||||
|
||||
this.locale = locale;
|
||||
this.processing = processing;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
setShortHelp(locale.getString(CmdHelpLang.WEB_LIST));
|
||||
}
|
||||
@ -83,7 +83,7 @@ public class WebListUsersCommand extends CommandNode {
|
||||
}
|
||||
sender.sendMessage(">");
|
||||
} 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()));
|
||||
}
|
||||
});
|
||||
|
@ -22,9 +22,9 @@ import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.settings.config.paths.ExportSettings;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
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.logging.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -46,7 +46,7 @@ public class ExportScheduler {
|
||||
|
||||
private final Exporter exporter;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public ExportScheduler(
|
||||
@ -55,14 +55,14 @@ public class ExportScheduler {
|
||||
TaskSystem taskSystem,
|
||||
Exporter exporter,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.config = config;
|
||||
this.dbSystem = dbSystem;
|
||||
this.taskSystem = taskSystem;
|
||||
this.exporter = exporter;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
public void scheduleExport() {
|
||||
@ -73,7 +73,7 @@ public class ExportScheduler {
|
||||
private void schedulePlayersPageExport() {
|
||||
long period = TimeAmount.toTicks(config.get(ExportSettings.EXPORT_PERIOD), TimeUnit.MILLISECONDS);
|
||||
taskSystem.registerTask("Players page export",
|
||||
new ExportTask(exporter, Exporter::exportPlayersPage, logger, errorHandler)
|
||||
new ExportTask(exporter, Exporter::exportPlayersPage, logger, errorLogger)
|
||||
).runTaskTimerAsynchronously(0L, period);
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ public class ExportScheduler {
|
||||
|
||||
Optional<Server> proxy = servers.stream().filter(Server::isProxy).findFirst();
|
||||
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)
|
||||
);
|
||||
|
||||
@ -99,7 +99,7 @@ public class ExportScheduler {
|
||||
new ExportTask(exporter, same -> {
|
||||
same.exportServerPage(server);
|
||||
same.exportServerJSON(server);
|
||||
}, logger, errorHandler))
|
||||
}, logger, errorLogger))
|
||||
.runTaskTimerAsynchronously(offset * offsetMultiplier, period);
|
||||
offsetMultiplier++;
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ package com.djrapitops.plan.delivery.export;
|
||||
import com.djrapitops.plan.exceptions.ExportException;
|
||||
import com.djrapitops.plan.exceptions.database.DBOpException;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
|
||||
public class ExportTask extends AbsRunnable {
|
||||
@ -29,18 +29,18 @@ public class ExportTask extends AbsRunnable {
|
||||
private final Exporter exporter;
|
||||
private final ThrowingConsumer<Exporter, ExportException> exportAction;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
public ExportTask(
|
||||
Exporter exporter,
|
||||
ThrowingConsumer<Exporter, ExportException> exportAction,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.exporter = exporter;
|
||||
this.exportAction = exportAction;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,12 +48,12 @@ public class ExportTask extends AbsRunnable {
|
||||
try {
|
||||
exportAction.accept(exporter);
|
||||
} catch (ExportException e) {
|
||||
errorHandler.log(L.WARN, this.getClass(), e);
|
||||
errorLogger.log(L.WARN, this.getClass(), e);
|
||||
} catch (DBOpException dbException) {
|
||||
handleDBException(dbException);
|
||||
} catch (Exception | NoClassDefFoundError | NoSuchMethodError | NoSuchFieldError e) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@ public class ExportTask extends AbsRunnable {
|
||||
if (dbException.getMessage().contains("closed")) {
|
||||
logger.warn("(Error was caused by database closing, so this error can possibly be ignored.)");
|
||||
} else {
|
||||
errorHandler.log(L.ERROR, this.getClass(), dbException);
|
||||
errorLogger.log(L.ERROR, this.getClass(), dbException);
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
|
@ -30,21 +30,16 @@ import com.djrapitops.plan.gathering.domain.Session;
|
||||
import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.identification.properties.ServerProperties;
|
||||
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.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plan.version.VersionChecker;
|
||||
import com.djrapitops.plugin.benchmarking.Benchmark;
|
||||
import com.djrapitops.plugin.benchmarking.Timings;
|
||||
import com.djrapitops.plugin.logging.FolderTimeStampFileLogger;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.debug.CombineDebugLogger;
|
||||
import com.djrapitops.plugin.logging.debug.DebugLogger;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
@ -60,7 +55,7 @@ public class DebugPage implements Page {
|
||||
private final VersionChecker versionChecker;
|
||||
private final CombineDebugLogger debugLogger;
|
||||
private final Timings timings;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private final Formatter<Long> yearFormatter;
|
||||
|
||||
@ -73,7 +68,7 @@ public class DebugPage implements Page {
|
||||
VersionChecker versionChecker,
|
||||
DebugLogger debugLogger,
|
||||
Timings timings,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.template = htmlTemplate;
|
||||
|
||||
@ -82,7 +77,7 @@ public class DebugPage implements Page {
|
||||
this.versionChecker = versionChecker;
|
||||
this.debugLogger = (CombineDebugLogger) debugLogger;
|
||||
this.timings = timings;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
this.yearFormatter = formatters.yearLong();
|
||||
}
|
||||
@ -140,7 +135,7 @@ public class DebugPage implements Page {
|
||||
}
|
||||
content.append("</pre>");
|
||||
} 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>");
|
||||
} 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>");
|
||||
} 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) {
|
||||
content.append("<pre>### Logged Errors<br>");
|
||||
|
||||
if (errorHandler instanceof DefaultErrorHandler) {
|
||||
appendErrorLines(content, (DefaultErrorHandler) errorHandler);
|
||||
} else {
|
||||
content.append("Using incompatible ErrorHandler");
|
||||
}
|
||||
|
||||
content.append("Using incompatible ErrorHandler");
|
||||
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>```<br>")
|
||||
.append(error)
|
||||
.append("```");
|
||||
}
|
||||
} else {
|
||||
content.append("**No Errors logged.**<br>");
|
||||
}
|
||||
}
|
||||
|
||||
private void appendDebugLog(StringBuilder content) {
|
||||
Optional<MemoryDebugLogger> memoryDebugLogger = this.debugLogger.getDebugLogger(MemoryDebugLogger.class);
|
||||
Map<String, List<String>> channels = memoryDebugLogger.map(MemoryDebugLogger::getChannels).orElse(new HashMap<>());
|
||||
|
@ -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.objects.ServerQueries;
|
||||
import com.djrapitops.plan.storage.file.PlanFiles;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plan.version.VersionChecker;
|
||||
import com.djrapitops.plugin.benchmarking.Timings;
|
||||
import com.djrapitops.plugin.logging.debug.DebugLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import dagger.Lazy;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -63,7 +63,7 @@ public class PageFactory {
|
||||
private final Lazy<Formatters> formatters;
|
||||
private final Lazy<DebugLogger> debugLogger;
|
||||
private final Lazy<Timings> timings;
|
||||
private final Lazy<ErrorHandler> errorHandler;
|
||||
private final Lazy<ErrorLogger> errorLogger;
|
||||
|
||||
@Inject
|
||||
public PageFactory(
|
||||
@ -77,7 +77,7 @@ public class PageFactory {
|
||||
Lazy<Formatters> formatters,
|
||||
Lazy<DebugLogger> debugLogger,
|
||||
Lazy<Timings> timings,
|
||||
Lazy<ErrorHandler> errorHandler
|
||||
Lazy<ErrorLogger> errorLogger
|
||||
) {
|
||||
this.versionChecker = versionChecker;
|
||||
this.files = files;
|
||||
@ -89,14 +89,14 @@ public class PageFactory {
|
||||
this.formatters = formatters;
|
||||
this.debugLogger = debugLogger;
|
||||
this.timings = timings;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
public DebugPage debugPage() throws IOException {
|
||||
return new DebugPage(
|
||||
getResource("error.html"),
|
||||
dbSystem.get().getDatabase(), serverInfo.get(), formatters.get(), versionChecker.get(),
|
||||
debugLogger.get(), timings.get(), errorHandler.get()
|
||||
debugLogger.get(), timings.get(), errorLogger.get()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,9 @@ import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.lang.PluginLang;
|
||||
import com.djrapitops.plan.storage.file.PlanFiles;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.text.TextStringBuilder;
|
||||
|
||||
@ -53,7 +53,7 @@ public class ResourceSvc implements ResourceService {
|
||||
private final ResourceSettings resourceSettings;
|
||||
private final Locale locale;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public ResourceSvc(
|
||||
@ -61,13 +61,13 @@ public class ResourceSvc implements ResourceService {
|
||||
PlanConfig config,
|
||||
Locale locale,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.files = files;
|
||||
this.resourceSettings = config.getResourceSettings();
|
||||
this.locale = locale;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
this.snippets = new HashSet<>();
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ public class ResourceSvc implements ResourceService {
|
||||
return getOrWriteCustomized(fileName, source);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
errorHandler.log(L.WARN, getClass(), e.getCause());
|
||||
errorLogger.log(L.WARN, getClass(), e.getCause());
|
||||
}
|
||||
// Return original by default
|
||||
return source.get();
|
||||
|
@ -19,9 +19,9 @@ package com.djrapitops.plan.delivery.webserver;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.settings.config.paths.PluginSettings;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -36,20 +36,20 @@ public class NonProxyWebserverDisableChecker implements Runnable {
|
||||
private final Addresses addresses;
|
||||
private final WebServerSystem webServerSystem;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
public NonProxyWebserverDisableChecker(
|
||||
PlanConfig config,
|
||||
Addresses addresses,
|
||||
WebServerSystem webServerSystem,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.config = config;
|
||||
this.addresses = addresses;
|
||||
this.webServerSystem = webServerSystem;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -75,7 +75,7 @@ public class NonProxyWebserverDisableChecker implements Runnable {
|
||||
logger.warn("Note: Set '" + WebserverSettings.DISABLED.getPath() + "' to true");
|
||||
|
||||
} catch (IOException e) {
|
||||
errorHandler.log(L.WARN, this.getClass(), e);
|
||||
errorLogger.log(L.WARN, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
}
|
@ -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.WebserverSettings;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
import com.sun.net.httpserver.Headers;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
@ -62,7 +62,7 @@ public class RequestHandler implements HttpHandler {
|
||||
private final ResponseResolver responseResolver;
|
||||
private final ResponseFactory responseFactory;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private final PassBruteForceGuard bruteForceGuard;
|
||||
|
||||
@ -74,7 +74,7 @@ public class RequestHandler implements HttpHandler {
|
||||
ResponseResolver responseResolver,
|
||||
ResponseFactory responseFactory,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.config = config;
|
||||
this.dbSystem = dbSystem;
|
||||
@ -82,7 +82,7 @@ public class RequestHandler implements HttpHandler {
|
||||
this.responseResolver = responseResolver;
|
||||
this.responseFactory = responseFactory;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
bruteForceGuard = new PassBruteForceGuard();
|
||||
}
|
||||
@ -99,7 +99,7 @@ public class RequestHandler implements HttpHandler {
|
||||
} catch (Exception e) {
|
||||
if (config.isTrue(PluginSettings.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 {
|
||||
exchange.close();
|
||||
|
@ -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.exceptions.WebUserAuthException;
|
||||
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.error.ErrorHandler;
|
||||
import dagger.Lazy;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -59,12 +59,12 @@ public class ResponseResolver {
|
||||
private final RootPageResolver rootPageResolver;
|
||||
private final RootJSONResolver rootJSONResolver;
|
||||
private final StaticResourceResolver staticResourceResolver;
|
||||
private LoginPageResolver loginPageResolver;
|
||||
private RegisterPageResolver registerPageResolver;
|
||||
private LoginResolver loginResolver;
|
||||
private LogoutResolver logoutResolver;
|
||||
private RegisterResolver registerResolver;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final LoginPageResolver loginPageResolver;
|
||||
private final RegisterPageResolver registerPageResolver;
|
||||
private final LoginResolver loginResolver;
|
||||
private final LogoutResolver logoutResolver;
|
||||
private final RegisterResolver registerResolver;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private final ResolverService resolverService;
|
||||
private final ResponseFactory responseFactory;
|
||||
@ -90,7 +90,7 @@ public class ResponseResolver {
|
||||
LogoutResolver logoutResolver,
|
||||
RegisterResolver registerResolver,
|
||||
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.resolverService = resolverService;
|
||||
this.responseFactory = responseFactory;
|
||||
@ -107,7 +107,7 @@ public class ResponseResolver {
|
||||
this.loginResolver = loginResolver;
|
||||
this.logoutResolver = logoutResolver;
|
||||
this.registerResolver = registerResolver;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
public void registerPages() {
|
||||
@ -143,7 +143,7 @@ public class ResponseResolver {
|
||||
} catch (WebUserAuthException e) {
|
||||
throw e; // Pass along
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
return responseFactory.internalErrorResponse(e, request.getPath().asString());
|
||||
}
|
||||
}
|
||||
|
@ -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.lang.PluginLang;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
import com.sun.net.httpserver.HttpsConfigurator;
|
||||
import com.sun.net.httpserver.HttpsParameters;
|
||||
@ -59,7 +59,7 @@ public class WebServer implements SubSystem {
|
||||
private final RequestHandler requestHandler;
|
||||
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private int port;
|
||||
private boolean enabled = false;
|
||||
@ -74,7 +74,7 @@ public class WebServer implements SubSystem {
|
||||
PlanConfig config,
|
||||
Addresses addresses,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler,
|
||||
ErrorLogger errorLogger,
|
||||
RequestHandler requestHandler
|
||||
) {
|
||||
this.locale = locale;
|
||||
@ -85,7 +85,7 @@ public class WebServer implements SubSystem {
|
||||
this.requestHandler = requestHandler;
|
||||
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -145,7 +145,7 @@ public class WebServer implements SubSystem {
|
||||
.namingPattern("Plan WebServer Thread-%d")
|
||||
.uncaughtExceptionHandler((thread, throwable) -> {
|
||||
if (config.isTrue(PluginSettings.DEV_MODE)) {
|
||||
errorHandler.log(L.WARN, WebServer.class, throwable);
|
||||
errorLogger.log(L.WARN, WebServer.class, throwable);
|
||||
}
|
||||
}).build()
|
||||
);
|
||||
@ -165,7 +165,7 @@ public class WebServer implements SubSystem {
|
||||
logger.error("Webserver failed to bind port: " + failedToBind.toString());
|
||||
enabled = false;
|
||||
} catch (IllegalArgumentException | IllegalStateException | IOException e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
@ -183,7 +183,7 @@ public class WebServer implements SubSystem {
|
||||
}
|
||||
} catch (InvalidPathException e) {
|
||||
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();
|
||||
@ -232,7 +232,7 @@ public class WebServer implements SubSystem {
|
||||
logger.error(e.getMessage());
|
||||
} catch (KeyManagementException | NoSuchAlgorithmException e) {
|
||||
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) {
|
||||
logger.error(locale.getString(PluginLang.WEB_SERVER_FAIL_EMPTY_FILE));
|
||||
} catch (FileNotFoundException e) {
|
||||
@ -242,10 +242,10 @@ public class WebServer implements SubSystem {
|
||||
throw e; // Pass to above error handler
|
||||
} catch (IOException e) {
|
||||
logger.error("WebServer: " + e);
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
} catch (KeyStoreException | CertificateException | UnrecoverableKeyException e) {
|
||||
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;
|
||||
}
|
||||
|
@ -29,9 +29,9 @@ import com.djrapitops.plan.processing.Processing;
|
||||
import com.djrapitops.plan.settings.config.ExtensionSettings;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -55,7 +55,7 @@ public class ExtensionSvc implements ExtensionService {
|
||||
private final Processing processing;
|
||||
private final ExtensionRegister extensionRegister;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private final Map<String, ProviderValueGatherer> extensionGatherers;
|
||||
|
||||
@ -67,7 +67,7 @@ public class ExtensionSvc implements ExtensionService {
|
||||
Processing processing,
|
||||
ExtensionRegister extensionRegister,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.config = config;
|
||||
this.dbSystem = dbSystem;
|
||||
@ -75,7 +75,7 @@ public class ExtensionSvc implements ExtensionService {
|
||||
this.processing = processing;
|
||||
this.extensionRegister = extensionRegister;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
extensionGatherers = new HashMap<>();
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class ExtensionSvc implements ExtensionService {
|
||||
extensionRegister.registerBuiltInExtensions(config.getExtensionSettings().getDisabled());
|
||||
} catch (IllegalStateException failedToRegisterOne) {
|
||||
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 {
|
||||
pluginsConfig.createSection(pluginName);
|
||||
} 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());
|
||||
return true;
|
||||
}
|
||||
@ -168,7 +168,7 @@ public class ExtensionSvc implements ExtensionService {
|
||||
logger.warn("Encountered unexpected error with " + gatherer.getPluginName() + " Extension: " + unexpectedError +
|
||||
" (but failed safely) when updating value for '" + playerName +
|
||||
"', 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 +
|
||||
"', the method was disabled temporarily (won't be called until next Plan reload)" +
|
||||
", stack trace to follow (please report this):");
|
||||
errorHandler.log(L.WARN, getClass(), cause);
|
||||
errorLogger.log(L.WARN, getClass(), cause);
|
||||
}
|
||||
|
||||
public void updateServerValues(CallEvents event) {
|
||||
@ -208,7 +208,7 @@ public class ExtensionSvc implements ExtensionService {
|
||||
} catch (Exception | NoClassDefFoundError | NoSuchFieldError | NoSuchMethodError 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):");
|
||||
errorHandler.log(L.WARN, gatherer.getClass(), unexpectedError);
|
||||
errorLogger.log(L.WARN, gatherer.getClass(), unexpectedError);
|
||||
}
|
||||
}
|
||||
}
|
@ -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.Database;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@ -44,21 +44,21 @@ public abstract class ServerShutdownSave {
|
||||
protected final PluginLogger logger;
|
||||
private final DBSystem dbSystem;
|
||||
private final Locale locale;
|
||||
private final ErrorHandler errorHandler;
|
||||
private boolean shuttingDown = false;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private boolean shuttingDown = false;
|
||||
private boolean startedDatabase = false;
|
||||
|
||||
public ServerShutdownSave(
|
||||
Locale locale,
|
||||
DBSystem dbSystem,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.locale = locale;
|
||||
this.dbSystem = dbSystem;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
protected abstract boolean checkServerShuttingDownStatus();
|
||||
@ -90,7 +90,7 @@ public abstract class ServerShutdownSave {
|
||||
prepareSessionsForStorage(activeSessions, System.currentTimeMillis());
|
||||
return Optional.of(saveActiveSessions(activeSessions));
|
||||
} catch (DBInitException e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
return Optional.empty();
|
||||
} catch (IllegalStateException ignored) {
|
||||
/* Database is not initialized */
|
||||
|
@ -22,8 +22,8 @@ import com.djrapitops.plan.exceptions.database.DBOpException;
|
||||
import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -42,7 +42,7 @@ public class NicknameCache implements SubSystem {
|
||||
|
||||
private final DBSystem dbSystem;
|
||||
private final ServerInfo serverInfo;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private final Map<UUID, String> displayNames;
|
||||
|
||||
@ -50,11 +50,11 @@ public class NicknameCache implements SubSystem {
|
||||
public NicknameCache(
|
||||
DBSystem dbSystem,
|
||||
ServerInfo serverInfo,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.dbSystem = dbSystem;
|
||||
this.serverInfo = serverInfo;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
displayNames = new HashMap<>();
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ public class NicknameCache implements SubSystem {
|
||||
NicknameQueries.fetchLastSeenNicknameOfPlayer(uuid, serverInfo.getServerUUID())
|
||||
).map(Nickname::getName);
|
||||
} catch (DBOpException e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
@ -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.Maximum;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -43,9 +43,9 @@ public class ProxyTPSCounter extends TPSCounter {
|
||||
private final SystemUsageBuffer systemUsage;
|
||||
private final DBSystem dbSystem;
|
||||
private final ServerInfo serverInfo;
|
||||
private Maximum.ForInteger playersOnline;
|
||||
private Average cpu;
|
||||
private TimerAverage ram;
|
||||
private final Maximum.ForInteger playersOnline;
|
||||
private final Average cpu;
|
||||
private final TimerAverage ram;
|
||||
|
||||
@Inject
|
||||
public ProxyTPSCounter(
|
||||
@ -54,9 +54,9 @@ public class ProxyTPSCounter extends TPSCounter {
|
||||
DBSystem dbSystem,
|
||||
ServerInfo serverInfo,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super(logger, errorHandler);
|
||||
super(logger, errorLogger);
|
||||
|
||||
this.serverSensor = serverSensor;
|
||||
this.dbSystem = dbSystem;
|
||||
|
@ -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.Maximum;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -47,9 +47,9 @@ public class ServerTPSCounter<W> extends TPSCounter {
|
||||
private final ServerInfo serverInfo;
|
||||
private TPSCalculator indirectTPS;
|
||||
private TimerAverage directTPS;
|
||||
private Maximum.ForInteger playersOnline;
|
||||
private Average cpu;
|
||||
private Average ram;
|
||||
private final Maximum.ForInteger playersOnline;
|
||||
private final Average cpu;
|
||||
private final Average ram;
|
||||
|
||||
@Inject
|
||||
public ServerTPSCounter(
|
||||
@ -58,9 +58,9 @@ public class ServerTPSCounter<W> extends TPSCounter {
|
||||
DBSystem dbSystem,
|
||||
ServerInfo serverInfo,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super(logger, errorHandler);
|
||||
super(logger, errorLogger);
|
||||
|
||||
noDirectTPS = !serverSensor.supportsDirectTPS();
|
||||
this.serverSensor = serverSensor;
|
||||
|
@ -19,9 +19,9 @@ package com.djrapitops.plan.gathering.timed;
|
||||
import com.djrapitops.plan.gathering.SystemUsage;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -90,17 +90,17 @@ public class SystemUsageBuffer {
|
||||
private final PlanConfig config;
|
||||
private final SystemUsageBuffer buffer;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private Boolean gatherDisk = null;
|
||||
private boolean diskErrored = false;
|
||||
|
||||
@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.buffer = buffer;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -111,7 +111,7 @@ public class SystemUsageBuffer {
|
||||
buffer.freeDiskSpace = SystemUsage.getFreeDiskSpace();
|
||||
} catch (SecurityException noPermission) {
|
||||
if (!diskErrored) {
|
||||
errorHandler.log(L.WARN, this.getClass(), noPermission);
|
||||
errorLogger.log(L.WARN, this.getClass(), noPermission);
|
||||
}
|
||||
diskErrored = true;
|
||||
} catch (Exception e) {
|
||||
|
@ -16,9 +16,9 @@
|
||||
*/
|
||||
package com.djrapitops.plan.gathering.timed;
|
||||
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
|
||||
/**
|
||||
@ -29,14 +29,14 @@ import com.djrapitops.plugin.task.AbsRunnable;
|
||||
public abstract class TPSCounter extends AbsRunnable {
|
||||
|
||||
protected final PluginLogger logger;
|
||||
protected final ErrorHandler errorHandler;
|
||||
protected final ErrorLogger errorLogger;
|
||||
|
||||
public TPSCounter(
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -45,7 +45,7 @@ public abstract class TPSCounter extends AbsRunnable {
|
||||
pulse();
|
||||
} catch (Exception | NoClassDefFoundError | NoSuchMethodError | NoSuchFieldError e) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.queries.objects.ServerQueries;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -53,7 +53,7 @@ public class ServerServerInfo extends ServerInfo {
|
||||
private final Processing processing;
|
||||
private final DBSystem dbSystem;
|
||||
private final Addresses addresses;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public ServerServerInfo(
|
||||
@ -63,7 +63,7 @@ public class ServerServerInfo extends ServerInfo {
|
||||
PlanConfig config,
|
||||
DBSystem dbSystem,
|
||||
Addresses addresses,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super(serverProperties);
|
||||
this.serverInfoFile = serverInfoFile;
|
||||
@ -71,7 +71,7 @@ public class ServerServerInfo extends ServerInfo {
|
||||
this.dbSystem = dbSystem;
|
||||
this.addresses = addresses;
|
||||
this.config = config;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -114,7 +114,7 @@ public class ServerServerInfo extends ServerInfo {
|
||||
try {
|
||||
server = registerServer(serverUUID);
|
||||
} catch (ExecutionException | IOException e) {
|
||||
errorHandler.log(L.CRITICAL, this.getClass(), e);
|
||||
errorLogger.log(L.CRITICAL, this.getClass(), e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ package com.djrapitops.plan.identification;
|
||||
import com.djrapitops.plan.exceptions.database.DBOpException;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
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.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -42,12 +42,12 @@ import java.util.UUID;
|
||||
public class UUIDUtility {
|
||||
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public UUIDUtility(DBSystem dbSystem, ErrorHandler errorHandler) {
|
||||
public UUIDUtility(DBSystem dbSystem, ErrorLogger errorLogger) {
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
public static Optional<UUID> parseFromString(String uuidString) {
|
||||
@ -92,7 +92,7 @@ public class UUIDUtility {
|
||||
try {
|
||||
return dbSystem.getDatabase().query(UserIdentifierQueries.fetchPlayerUUIDOf(playerName));
|
||||
} catch (DBOpException e) {
|
||||
errorHandler.log(L.ERROR, UUIDUtility.class, e);
|
||||
errorLogger.log(L.ERROR, UUIDUtility.class, e);
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ package com.djrapitops.plan.processing;
|
||||
import com.djrapitops.plan.SubSystem;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import dagger.Lazy;
|
||||
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
||||
|
||||
@ -35,7 +35,7 @@ public class Processing implements SubSystem {
|
||||
|
||||
private final Lazy<Locale> locale;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private ExecutorService nonCriticalExecutor;
|
||||
private ExecutorService criticalExecutor;
|
||||
@ -44,11 +44,11 @@ public class Processing implements SubSystem {
|
||||
public Processing(
|
||||
Lazy<Locale> locale,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.locale = locale;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
nonCriticalExecutor = createExecutor(6, "Plan Non critical-pool-%d");
|
||||
criticalExecutor = createExecutor(2, "Plan Critical-pool-%d");
|
||||
}
|
||||
@ -58,7 +58,7 @@ public class Processing implements SubSystem {
|
||||
new BasicThreadFactory.Builder()
|
||||
.namingPattern(s)
|
||||
.uncaughtExceptionHandler((thread, throwable) ->
|
||||
errorHandler.log(L.WARN, Processing.class, throwable)
|
||||
errorLogger.log(L.WARN, Processing.class, throwable)
|
||||
).build());
|
||||
}
|
||||
|
||||
@ -110,14 +110,14 @@ public class Processing implements SubSystem {
|
||||
|
||||
private <T> T exceptionHandlerNonCritical(T t, Throwable throwable) {
|
||||
if (throwable != null) {
|
||||
errorHandler.log(L.WARN, Processing.class, throwable.getCause());
|
||||
errorLogger.log(L.WARN, Processing.class, throwable.getCause());
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
private <T> T exceptionHandlerCritical(T t, Throwable throwable) {
|
||||
if (throwable != null) {
|
||||
errorHandler.log(L.ERROR, Processing.class, throwable.getCause());
|
||||
errorLogger.log(L.ERROR, Processing.class, throwable.getCause());
|
||||
}
|
||||
return t;
|
||||
}
|
||||
@ -163,7 +163,7 @@ public class Processing implements SubSystem {
|
||||
try {
|
||||
runnable.run();
|
||||
} catch (Exception | NoClassDefFoundError | NoSuchMethodError | NoSuchFieldError e) {
|
||||
errorHandler.log(L.WARN, this.getClass(), e);
|
||||
errorLogger.log(L.WARN, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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.QueryAPIQuery;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -43,7 +43,7 @@ public class QuerySvc implements QueryService {
|
||||
private final DBSystem dbSystem;
|
||||
private final ServerInfo serverInfo;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private final Set<Consumer<UUID>> playerRemoveSubscribers;
|
||||
private final Set<VoidFunction> clearSubscribers;
|
||||
@ -53,12 +53,12 @@ public class QuerySvc implements QueryService {
|
||||
DBSystem dbSystem,
|
||||
ServerInfo serverInfo,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.dbSystem = dbSystem;
|
||||
this.serverInfo = serverInfo;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
playerRemoveSubscribers = new HashSet<>();
|
||||
clearSubscribers = new HashSet<>();
|
||||
@ -108,7 +108,7 @@ public class QuerySvc implements QueryService {
|
||||
subscriber.accept(playerUUID);
|
||||
} catch (DBOpException e) {
|
||||
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();
|
||||
} catch (DBOpException e) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ import com.djrapitops.plan.settings.config.paths.PluginSettings;
|
||||
import com.djrapitops.plan.settings.network.ServerSettingsManager;
|
||||
import com.djrapitops.plan.settings.theme.Theme;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -52,9 +52,9 @@ public class BukkitConfigSystem extends ConfigSystem {
|
||||
ServerSettingsManager serverSettingsManager,
|
||||
Theme theme,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super(files, config, theme, logger, errorHandler);
|
||||
super(files, config, theme, logger, errorLogger);
|
||||
this.configUpdater = configUpdater;
|
||||
this.serverSettingsManager = serverSettingsManager;
|
||||
}
|
||||
|
@ -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.theme.Theme;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.debug.*;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
@ -46,20 +46,20 @@ public abstract class ConfigSystem implements SubSystem {
|
||||
protected final PlanConfig config;
|
||||
protected final Theme theme;
|
||||
protected final PluginLogger logger;
|
||||
protected final ErrorHandler errorHandler;
|
||||
protected final ErrorLogger errorLogger;
|
||||
|
||||
public ConfigSystem(
|
||||
PlanFiles files,
|
||||
PlanConfig config,
|
||||
Theme theme,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.files = files;
|
||||
this.config = config;
|
||||
this.theme = theme;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
public PlanConfig getConfig() {
|
||||
@ -86,7 +86,7 @@ public abstract class ConfigSystem implements SubSystem {
|
||||
|
||||
checkWrongTimeZone();
|
||||
} 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);
|
||||
}
|
||||
theme.enable();
|
||||
@ -110,7 +110,7 @@ public abstract class ConfigSystem implements SubSystem {
|
||||
loggers.add(new ConsoleDebugLogger(logger));
|
||||
}
|
||||
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")) {
|
||||
loggers.add(debugLogger.getDebugLogger(MemoryDebugLogger.class).orElse(new MemoryDebugLogger()));
|
||||
@ -134,7 +134,7 @@ public abstract class ConfigSystem implements SubSystem {
|
||||
try {
|
||||
config.read();
|
||||
} catch (IOException e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ import com.djrapitops.plan.settings.config.paths.PluginSettings;
|
||||
import com.djrapitops.plan.settings.network.ServerSettingsManager;
|
||||
import com.djrapitops.plan.settings.theme.Theme;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -54,9 +54,9 @@ public class NukkitConfigSystem extends ConfigSystem {
|
||||
ServerSettingsManager serverSettingsManager,
|
||||
Theme theme,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super(files, config, theme, logger, errorHandler);
|
||||
super(files, config, theme, logger, errorLogger);
|
||||
this.configUpdater = configUpdater;
|
||||
this.serverSettingsManager = serverSettingsManager;
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ import com.djrapitops.plan.settings.config.changes.ConfigUpdater;
|
||||
import com.djrapitops.plan.settings.network.NetworkSettingManager;
|
||||
import com.djrapitops.plan.settings.theme.Theme;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -51,9 +51,9 @@ public class ProxyConfigSystem extends ConfigSystem {
|
||||
NetworkSettingManager networkSettingManager,
|
||||
Theme theme,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super(files, config, theme, logger, errorHandler);
|
||||
super(files, config, theme, logger, errorLogger);
|
||||
this.configUpdater = configUpdater;
|
||||
this.networkSettingManager = networkSettingManager;
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ package com.djrapitops.plan.settings;
|
||||
|
||||
import com.djrapitops.plan.settings.config.ConfigNode;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -37,15 +37,15 @@ import java.util.function.Supplier;
|
||||
public class SettingsSvc implements SettingsService {
|
||||
|
||||
private final PlanConfig config;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public SettingsSvc(
|
||||
PlanConfig config,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.config = config;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
public void register() {
|
||||
@ -70,7 +70,7 @@ public class SettingsSvc implements SettingsService {
|
||||
try {
|
||||
config.save();
|
||||
} catch (IOException e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,8 @@ import com.djrapitops.plan.settings.config.paths.WebserverSettings;
|
||||
import com.djrapitops.plan.settings.network.ServerSettingsManager;
|
||||
import com.djrapitops.plan.settings.theme.Theme;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -49,9 +49,9 @@ public class SpongeConfigSystem extends BukkitConfigSystem {
|
||||
ServerSettingsManager serverSettingsManager,
|
||||
Theme theme,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super(files, config, configUpdater, serverSettingsManager, theme, logger, errorHandler);
|
||||
super(files, config, configUpdater, serverSettingsManager, theme, logger, errorLogger);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.lang.GenericLang;
|
||||
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.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
import dagger.Lazy;
|
||||
|
||||
@ -52,7 +52,7 @@ public class WorldAliasSettings {
|
||||
private final Supplier<Formatter<Double>> percentageFormatter;
|
||||
private final Lazy<Locale> locale;
|
||||
private final Processing processing;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public WorldAliasSettings(
|
||||
@ -60,12 +60,12 @@ public class WorldAliasSettings {
|
||||
Lazy<Locale> locale,
|
||||
Lazy<Formatters> formatters,
|
||||
Processing processing,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.config = config;
|
||||
this.locale = locale;
|
||||
this.processing = processing;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
percentageFormatter = () -> formatters.get().percentage();
|
||||
}
|
||||
@ -93,7 +93,7 @@ public class WorldAliasSettings {
|
||||
try {
|
||||
aliasSect.save();
|
||||
} catch (IOException e) {
|
||||
errorHandler.log(L.WARN, WorldAliasSettings.class, e);
|
||||
errorLogger.log(L.WARN, WorldAliasSettings.class, e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ package com.djrapitops.plan.settings.config.changes;
|
||||
|
||||
import com.djrapitops.plan.settings.config.Config;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -35,15 +35,15 @@ import java.io.IOException;
|
||||
public class ConfigUpdater {
|
||||
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public ConfigUpdater(
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
public void applyConfigUpdate(Config config) throws IOException {
|
||||
@ -152,7 +152,7 @@ public class ConfigUpdater {
|
||||
logger.info("Config: " + change.getAppliedMessage());
|
||||
}
|
||||
} 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.settings.config.paths.PluginSettings;
|
||||
import com.djrapitops.plan.settings.locale.lang.*;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -47,7 +47,7 @@ public class LocaleSystem implements SubSystem {
|
||||
private final PlanFiles files;
|
||||
private final PlanConfig config;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private final Locale locale;
|
||||
|
||||
@ -56,12 +56,12 @@ public class LocaleSystem implements SubSystem {
|
||||
PlanFiles files,
|
||||
PlanConfig config,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.files = files;
|
||||
this.config = config;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
this.locale = new Locale();
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ public class LocaleSystem implements SubSystem {
|
||||
new LocaleFileWriter(writing).writeToFile(localeFile);
|
||||
} catch (IOException | IllegalStateException e) {
|
||||
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();
|
||||
}
|
||||
@ -124,7 +124,7 @@ public class LocaleSystem implements SubSystem {
|
||||
config.save();
|
||||
} catch (IOException | IllegalStateException e) {
|
||||
logger.error("Failed set WriteNewLocaleFileOnEnable back to false");
|
||||
errorHandler.log(L.WARN, this.getClass(), e);
|
||||
errorLogger.log(L.WARN, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.transactions.StoreConfigTransaction;
|
||||
import com.djrapitops.plan.storage.file.PlanFiles;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
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.RunnableFactory;
|
||||
|
||||
@ -66,7 +66,7 @@ public class NetworkSettingManager implements SubSystem {
|
||||
private final RunnableFactory runnableFactory;
|
||||
private final PlanConfig config;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private File serverSettingsFolder;
|
||||
|
||||
@ -80,7 +80,7 @@ public class NetworkSettingManager implements SubSystem {
|
||||
ServerInfo serverInfo,
|
||||
RunnableFactory runnableFactory,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.files = files;
|
||||
this.config = config;
|
||||
@ -89,7 +89,7 @@ public class NetworkSettingManager implements SubSystem {
|
||||
this.runnableFactory = runnableFactory;
|
||||
this.logger = logger;
|
||||
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -117,7 +117,7 @@ public class NetworkSettingManager implements SubSystem {
|
||||
}
|
||||
|
||||
private FileWatcher prepareFileWatcher() {
|
||||
FileWatcher fileWatcher = new FileWatcher(serverSettingsFolder, errorHandler);
|
||||
FileWatcher fileWatcher = new FileWatcher(serverSettingsFolder, errorLogger);
|
||||
|
||||
File[] files = getConfigFiles();
|
||||
if (files != null) {
|
||||
|
@ -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.transactions.StoreConfigTransaction;
|
||||
import com.djrapitops.plan.storage.file.PlanFiles;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -63,7 +63,7 @@ public class ServerSettingsManager implements SubSystem {
|
||||
private final DBSystem dbSystem;
|
||||
private final ServerInfo serverInfo;
|
||||
private final TaskSystem taskSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
private final PluginLogger logger;
|
||||
private FileWatcher watcher;
|
||||
|
||||
@ -75,7 +75,7 @@ public class ServerSettingsManager implements SubSystem {
|
||||
ServerInfo serverInfo,
|
||||
TaskSystem taskSystem,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.files = files;
|
||||
this.config = config;
|
||||
@ -83,7 +83,7 @@ public class ServerSettingsManager implements SubSystem {
|
||||
this.serverInfo = serverInfo;
|
||||
this.taskSystem = taskSystem;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -95,7 +95,7 @@ public class ServerSettingsManager implements SubSystem {
|
||||
}
|
||||
|
||||
private FileWatcher prepareFileWatcher() {
|
||||
FileWatcher fileWatcher = new FileWatcher(files.getDataFolder(), errorHandler);
|
||||
FileWatcher fileWatcher = new FileWatcher(files.getDataFolder(), errorLogger);
|
||||
File configFile = files.getConfigFile();
|
||||
fileWatcher.addToWatchlist(new WatchedFile(configFile,
|
||||
() -> updateConfigInDB(configFile)
|
||||
|
@ -16,8 +16,8 @@
|
||||
*/
|
||||
package com.djrapitops.plan.settings.upkeep;
|
||||
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
|
||||
import java.io.File;
|
||||
@ -36,7 +36,7 @@ import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
|
||||
*/
|
||||
public class FileWatcher extends Thread {
|
||||
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private volatile boolean running;
|
||||
|
||||
@ -45,16 +45,16 @@ public class FileWatcher extends Thread {
|
||||
|
||||
public FileWatcher(
|
||||
File folder,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this(folder.toPath(), errorHandler);
|
||||
this(folder.toPath(), errorLogger);
|
||||
}
|
||||
|
||||
public FileWatcher(
|
||||
Path watchedPath,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
this.running = false;
|
||||
this.watchedFiles = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
|
||||
@ -75,7 +75,7 @@ public class FileWatcher extends Thread {
|
||||
watchedPath.register(watcher, ENTRY_MODIFY);
|
||||
runLoop(watcher);
|
||||
} catch (IOException e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
interrupt();
|
||||
} catch (InterruptedException e) {
|
||||
interrupt();
|
||||
|
@ -25,8 +25,8 @@ import com.djrapitops.plan.storage.file.PlanFiles;
|
||||
import com.djrapitops.plan.storage.upkeep.DBKeepAliveTask;
|
||||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
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.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.task.PluginTask;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import dagger.Lazy;
|
||||
@ -58,9 +58,9 @@ public class H2DB extends SQLDB {
|
||||
Lazy<ServerInfo> serverInfo,
|
||||
RunnableFactory runnableFactory,
|
||||
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();
|
||||
this.databaseFile = databaseFile;
|
||||
}
|
||||
@ -102,7 +102,7 @@ public class H2DB extends SQLDB {
|
||||
try {
|
||||
// Maintains Connection.
|
||||
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);
|
||||
} catch (Exception ignored) {
|
||||
// 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 RunnableFactory runnableFactory;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger1;
|
||||
private final PlanFiles files;
|
||||
|
||||
@Inject
|
||||
@ -186,7 +186,7 @@ public class H2DB extends SQLDB {
|
||||
Lazy<ServerInfo> serverInfo,
|
||||
RunnableFactory runnableFactory,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger1
|
||||
) {
|
||||
this.locale = locale;
|
||||
this.config = config;
|
||||
@ -194,7 +194,7 @@ public class H2DB extends SQLDB {
|
||||
this.serverInfo = serverInfo;
|
||||
this.runnableFactory = runnableFactory;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger1 = errorLogger1;
|
||||
}
|
||||
|
||||
public H2DB usingDefaultFile() {
|
||||
@ -208,7 +208,7 @@ public class H2DB extends SQLDB {
|
||||
public H2DB usingFile(File databaseFile) {
|
||||
return new H2DB(databaseFile,
|
||||
locale, config, serverInfo,
|
||||
runnableFactory, logger, errorHandler
|
||||
runnableFactory, logger, errorLogger1
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -23,10 +23,9 @@ import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.settings.config.paths.DatabaseSettings;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
@ -59,10 +58,9 @@ public class MySQLDB extends SQLDB {
|
||||
Lazy<ServerInfo> serverInfo,
|
||||
RunnableFactory runnableFactory,
|
||||
PluginLogger pluginLogger,
|
||||
Timings timings,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super(() -> serverInfo.get().getServerUUID(), locale, config, runnableFactory, pluginLogger, errorHandler);
|
||||
super(() -> serverInfo.get().getServerUUID(), locale, config, runnableFactory, pluginLogger, errorLogger);
|
||||
}
|
||||
|
||||
private static synchronized void increment() {
|
||||
@ -78,7 +76,7 @@ public class MySQLDB extends SQLDB {
|
||||
try {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
} 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();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,7 @@
|
||||
package com.djrapitops.plan.storage.database;
|
||||
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -38,9 +36,7 @@ public class ProxyDBSystem extends DBSystem {
|
||||
MySQLDB mySQLDB,
|
||||
SQLiteDB.Factory sqLiteDB,
|
||||
H2DB.Factory h2DB,
|
||||
PluginLogger logger,
|
||||
Timings timings,
|
||||
ErrorHandler errorHandler
|
||||
PluginLogger logger
|
||||
) {
|
||||
super(locale, sqLiteDB, h2DB, logger);
|
||||
databases.add(mySQLDB);
|
||||
|
@ -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.patches.*;
|
||||
import com.djrapitops.plan.utilities.java.ThrowableUtils;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
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.RunnableFactory;
|
||||
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
||||
@ -62,7 +62,7 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
protected final PlanConfig config;
|
||||
protected final RunnableFactory runnableFactory;
|
||||
protected final PluginLogger logger;
|
||||
protected final ErrorHandler errorHandler;
|
||||
protected final ErrorLogger errorLogger;
|
||||
|
||||
private Supplier<ExecutorService> transactionExecutorServiceProvider;
|
||||
private ExecutorService transactionExecutor;
|
||||
@ -75,14 +75,14 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
PlanConfig config,
|
||||
RunnableFactory runnableFactory,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.serverUUIDSupplier = serverUUIDSupplier;
|
||||
this.locale = locale;
|
||||
this.config = config;
|
||||
this.runnableFactory = runnableFactory;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
devMode = config.isTrue(PluginSettings.DEV_MODE);
|
||||
|
||||
@ -92,7 +92,7 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
.namingPattern(nameFormat)
|
||||
.uncaughtExceptionHandler((thread, throwable) -> {
|
||||
if (devMode) {
|
||||
errorHandler.log(L.WARN, getClass(), throwable);
|
||||
errorLogger.log(L.WARN, getClass(), throwable);
|
||||
}
|
||||
}).build());
|
||||
};
|
||||
@ -261,7 +261,7 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
}
|
||||
ThrowableUtils.appendEntryPointToCause(throwable, origin);
|
||||
|
||||
errorHandler.log(L.ERROR, getClass(), throwable);
|
||||
errorLogger.log(L.ERROR, getClass(), throwable);
|
||||
return CompletableFuture.completedFuture(null);
|
||||
};
|
||||
}
|
||||
|
@ -25,9 +25,9 @@ import com.djrapitops.plan.storage.file.PlanFiles;
|
||||
import com.djrapitops.plan.storage.upkeep.DBKeepAliveTask;
|
||||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.task.PluginTask;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import dagger.Lazy;
|
||||
@ -57,9 +57,9 @@ public class SQLiteDB extends SQLDB {
|
||||
Lazy<ServerInfo> serverInfo,
|
||||
RunnableFactory runnableFactory,
|
||||
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();
|
||||
this.databaseFile = databaseFile;
|
||||
}
|
||||
@ -80,7 +80,7 @@ public class SQLiteDB extends SQLDB {
|
||||
try {
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
} catch (ClassNotFoundException e) {
|
||||
errorHandler.log(L.CRITICAL, this.getClass(), e);
|
||||
errorLogger.log(L.CRITICAL, this.getClass(), e);
|
||||
return null; // Should never happen.
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ public class SQLiteDB extends SQLDB {
|
||||
try {
|
||||
// Maintains Connection.
|
||||
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);
|
||||
} catch (Exception ignored) {
|
||||
// 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 RunnableFactory runnableFactory;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger1;
|
||||
private final PlanFiles files;
|
||||
|
||||
@Inject
|
||||
@ -188,7 +188,7 @@ public class SQLiteDB extends SQLDB {
|
||||
Lazy<ServerInfo> serverInfo,
|
||||
RunnableFactory runnableFactory,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger1
|
||||
) {
|
||||
this.locale = locale;
|
||||
this.config = config;
|
||||
@ -196,7 +196,7 @@ public class SQLiteDB extends SQLDB {
|
||||
this.serverInfo = serverInfo;
|
||||
this.runnableFactory = runnableFactory;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger1 = errorLogger1;
|
||||
}
|
||||
|
||||
public SQLiteDB usingDefaultFile() {
|
||||
@ -210,7 +210,7 @@ public class SQLiteDB extends SQLDB {
|
||||
public SQLiteDB usingFile(File databaseFile) {
|
||||
return new SQLiteDB(databaseFile,
|
||||
locale, config, serverInfo,
|
||||
runnableFactory, logger, errorHandler
|
||||
runnableFactory, logger, errorLogger1
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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.RemoveOldExtensionsTransaction;
|
||||
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.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -64,7 +64,7 @@ public class DBCleanTask extends AbsRunnable {
|
||||
private final QuerySvc queryService;
|
||||
private final ServerInfo serverInfo;
|
||||
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.
|
||||
// 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,
|
||||
ServerInfo serverInfo,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.locale = locale;
|
||||
|
||||
@ -87,7 +87,7 @@ public class DBCleanTask extends AbsRunnable {
|
||||
this.queryService = queryService;
|
||||
this.serverInfo = serverInfo;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
|
||||
lastReload = System.currentTimeMillis();
|
||||
}
|
||||
@ -115,7 +115,7 @@ public class DBCleanTask extends AbsRunnable {
|
||||
}
|
||||
}
|
||||
} catch (DBOpException e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
@ -17,9 +17,9 @@
|
||||
package com.djrapitops.plan.storage.upkeep;
|
||||
|
||||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
|
||||
import java.sql.Connection;
|
||||
@ -35,14 +35,14 @@ import java.sql.Statement;
|
||||
public class DBKeepAliveTask extends AbsRunnable {
|
||||
private final IReconnect iReconnect;
|
||||
private final PluginLogger logger;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
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.iReconnect = iReconnect;
|
||||
this.logger = logger;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -59,7 +59,7 @@ public class DBKeepAliveTask extends AbsRunnable {
|
||||
try {
|
||||
connection = iReconnect.reconnect();
|
||||
} 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.");
|
||||
this.cancel();
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.djrapitops.plan.gathering;
|
||||
|
||||
import com.djrapitops.plan.PlanSystem;
|
||||
import com.djrapitops.plan.delivery.domain.keys.SessionKeys;
|
||||
import com.djrapitops.plan.gathering.cache.SessionCache;
|
||||
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.WorldNameStoreTransaction;
|
||||
import com.djrapitops.plugin.logging.console.TestPluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ConsoleErrorLogger;
|
||||
import extension.PrintExtension;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@ -72,11 +72,12 @@ class ShutdownSaveTest {
|
||||
.withLogging()
|
||||
.getPlanMock()
|
||||
).build();
|
||||
PlanSystem system = pluginComponent.system();
|
||||
|
||||
database = pluginComponent.system().getDatabaseSystem().getSqLiteFactory().usingFileCalled("test");
|
||||
database = system.getDatabaseSystem().getSqLiteFactory().usingFileCalled("test");
|
||||
database.init();
|
||||
|
||||
sessionCache = pluginComponent.system().getCacheSystem().getSessionCache();
|
||||
sessionCache = system.getCacheSystem().getSessionCache();
|
||||
|
||||
storeNecessaryInformation();
|
||||
placeSessionToCache();
|
||||
@ -85,7 +86,7 @@ class ShutdownSaveTest {
|
||||
when(dbSystemMock.getDatabase()).thenReturn(database);
|
||||
|
||||
TestPluginLogger logger = new TestPluginLogger();
|
||||
underTest = new ServerShutdownSave(new Locale(), dbSystemMock, logger, new ConsoleErrorLogger(logger)) {
|
||||
underTest = new ServerShutdownSave(new Locale(), dbSystemMock, logger, system.getErrorLogger()) {
|
||||
@Override
|
||||
protected boolean checkServerShuttingDownStatus() {
|
||||
return shutdownStatus;
|
||||
|
@ -20,12 +20,14 @@ import com.djrapitops.plan.settings.ConfigSettingKeyTest;
|
||||
import com.djrapitops.plan.settings.config.ConfigReader;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
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.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.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.Mockito;
|
||||
import utilities.TestResources;
|
||||
|
||||
import java.io.File;
|
||||
@ -55,6 +57,7 @@ class ConfigUpdaterTest {
|
||||
private static Path newBungeeConfig;
|
||||
|
||||
private static ConfigUpdater UNDER_TEST;
|
||||
private static ErrorLogger errorLogger;
|
||||
|
||||
@BeforeAll
|
||||
static void prepareConfigFiles() throws URISyntaxException, IOException {
|
||||
@ -73,7 +76,13 @@ class ConfigUpdaterTest {
|
||||
TestResources.copyResourceIntoFile(newBungeeConfig.toFile(), "/assets/plan/bungeeconfig.yml");
|
||||
|
||||
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
|
||||
|
@ -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.upkeep.DBCleanTask;
|
||||
import com.djrapitops.plugin.logging.console.TestPluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ConsoleErrorLogger;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import utilities.FieldFetcher;
|
||||
import utilities.RandomData;
|
||||
@ -131,15 +130,14 @@ public interface DatabaseTest extends DatabaseTestPreparer {
|
||||
execute(DataStoreQueries.storeSession(session));
|
||||
|
||||
TestPluginLogger logger = new TestPluginLogger();
|
||||
ConsoleErrorLogger errorHandler = new ConsoleErrorLogger(logger);
|
||||
new DBCleanTask(
|
||||
system().getConfigSystem().getConfig(),
|
||||
new Locale(),
|
||||
system().getDatabaseSystem(),
|
||||
new QuerySvc(system().getDatabaseSystem(), system().getServerInfo(), logger, errorHandler),
|
||||
new QuerySvc(system().getDatabaseSystem(), system().getServerInfo(), logger, null),
|
||||
system().getServerInfo(),
|
||||
logger,
|
||||
errorHandler
|
||||
null
|
||||
).cleanOldPlayers(db());
|
||||
|
||||
Collection<BaseUser> found = db().query(BaseUserQueries.fetchServerBaseUsers(serverUUID()));
|
||||
|
@ -18,8 +18,8 @@ package utilities.mocks;
|
||||
|
||||
import com.djrapitops.plan.processing.Processing;
|
||||
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.error.ErrorHandler;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import dagger.Lazy;
|
||||
|
||||
@ -36,8 +36,12 @@ import java.util.concurrent.ExecutorService;
|
||||
public class TestProcessing extends Processing {
|
||||
|
||||
@Inject
|
||||
public TestProcessing(Lazy<Locale> locale, PluginLogger logger, ErrorHandler errorHandler) {
|
||||
super(locale, logger, errorHandler);
|
||||
public TestProcessing(
|
||||
Lazy<Locale> locale,
|
||||
PluginLogger logger,
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super(locale, logger, errorLogger);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,4 +1,5 @@
|
||||
dependencies {
|
||||
compileOnly project(":common")
|
||||
compile project(path: ":common", configuration: 'shadow')
|
||||
compileOnly project(":api")
|
||||
|
||||
|
@ -19,8 +19,8 @@ package com.djrapitops.plan;
|
||||
import com.djrapitops.plan.gathering.ServerShutdownSave;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -38,9 +38,9 @@ public class NukkitServerShutdownSave extends ServerShutdownSave {
|
||||
Locale locale,
|
||||
DBSystem dbSystem,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super(locale, dbSystem, logger, errorHandler);
|
||||
super(locale, dbSystem, logger, errorLogger);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,8 +24,8 @@ import com.djrapitops.plan.delivery.domain.keys.PlayerKeys;
|
||||
import com.djrapitops.plan.gathering.cache.SessionCache;
|
||||
import com.djrapitops.plan.placeholder.PlanPlaceholders;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -42,17 +42,17 @@ public class NukkitPlaceholderRegistrar {
|
||||
|
||||
private final PlanPlaceholders placeholders;
|
||||
private final PlanSystem system;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public NukkitPlaceholderRegistrar(
|
||||
PlanPlaceholders placeholders,
|
||||
PlanSystem system,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.placeholders = placeholders;
|
||||
this.system = system;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
public void register() {
|
||||
@ -62,7 +62,7 @@ public class NukkitPlaceholderRegistrar {
|
||||
try {
|
||||
return loader.apply(getPlayer(player), new ArrayList<>(params.getAll().values()));
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.WARN, getClass(), e);
|
||||
errorLogger.log(L.WARN, getClass(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -73,7 +73,7 @@ public class NukkitPlaceholderRegistrar {
|
||||
try {
|
||||
return loader.apply(new ArrayList<>(params.getAll().values()));
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.WARN, getClass(), e);
|
||||
errorLogger.log(L.WARN, getClass(), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,8 @@ import com.djrapitops.plan.gathering.cache.NicknameCache;
|
||||
import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.UUID;
|
||||
@ -42,19 +42,19 @@ public class ChatListener implements Listener {
|
||||
private final ServerInfo serverInfo;
|
||||
private final DBSystem dbSystem;
|
||||
private final NicknameCache nicknameCache;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public ChatListener(
|
||||
ServerInfo serverInfo,
|
||||
DBSystem dbSystem,
|
||||
NicknameCache nicknameCache,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.serverInfo = serverInfo;
|
||||
this.dbSystem = dbSystem;
|
||||
this.nicknameCache = nicknameCache;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -66,7 +66,7 @@ public class ChatListener implements Listener {
|
||||
try {
|
||||
actOnChatEvent(event);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,8 @@ import com.djrapitops.plan.gathering.domain.Session;
|
||||
import com.djrapitops.plan.processing.Processing;
|
||||
import com.djrapitops.plan.processing.processors.player.MobKillProcessor;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.UUID;
|
||||
@ -49,15 +49,15 @@ import java.util.UUID;
|
||||
public class DeathEventListener implements Listener {
|
||||
|
||||
private final Processing processing;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public DeathEventListener(
|
||||
Processing processing,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.processing = processing;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -78,7 +78,7 @@ public class DeathEventListener implements Listener {
|
||||
UUID uuid = dead.getUniqueId();
|
||||
handleKill(time, uuid, killerEntity);
|
||||
} 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);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,8 @@ import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.settings.config.WorldAliasSettings;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Optional;
|
||||
@ -45,19 +45,19 @@ public class GameModeChangeListener implements Listener {
|
||||
private final WorldAliasSettings worldAliasSettings;
|
||||
private final ServerInfo serverInfo;
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public GameModeChangeListener(
|
||||
WorldAliasSettings worldAliasSettings,
|
||||
ServerInfo serverInfo,
|
||||
DBSystem dbSystem,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.worldAliasSettings = worldAliasSettings;
|
||||
this.serverInfo = serverInfo;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -68,7 +68,7 @@ public class GameModeChangeListener implements Listener {
|
||||
try {
|
||||
actOnEvent(event);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,8 @@ import cn.nukkit.event.player.*;
|
||||
import com.djrapitops.plan.gathering.afk.AFKTracker;
|
||||
import com.djrapitops.plan.settings.Permissions;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.HashMap;
|
||||
@ -46,11 +46,11 @@ public class NukkitAFKListener implements Listener {
|
||||
static AFKTracker AFK_TRACKER;
|
||||
|
||||
private final Map<UUID, Boolean> ignorePermissionInfo;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public NukkitAFKListener(PlanConfig config, ErrorHandler errorHandler) {
|
||||
this.errorHandler = errorHandler;
|
||||
public NukkitAFKListener(PlanConfig config, ErrorLogger errorLogger) {
|
||||
this.errorLogger = errorLogger;
|
||||
this.ignorePermissionInfo = new HashMap<>();
|
||||
|
||||
NukkitAFKListener.assignAFKTracker(config);
|
||||
@ -79,7 +79,7 @@ public class NukkitAFKListener implements Listener {
|
||||
|
||||
AFK_TRACKER.performedAction(uuid, time);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.Database;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.UUID;
|
||||
@ -68,7 +68,7 @@ public class PlayerOnlineListener implements Listener {
|
||||
private final GeolocationCache geolocationCache;
|
||||
private final NicknameCache nicknameCache;
|
||||
private final SessionCache sessionCache;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
private final Status status;
|
||||
|
||||
@Inject
|
||||
@ -83,7 +83,7 @@ public class PlayerOnlineListener implements Listener {
|
||||
NicknameCache nicknameCache,
|
||||
SessionCache sessionCache,
|
||||
Status status,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.config = config;
|
||||
this.processing = processing;
|
||||
@ -95,7 +95,7 @@ public class PlayerOnlineListener implements Listener {
|
||||
this.nicknameCache = nicknameCache;
|
||||
this.sessionCache = sessionCache;
|
||||
this.status = status;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -105,7 +105,7 @@ public class PlayerOnlineListener implements Listener {
|
||||
boolean operator = event.getPlayer().isOp();
|
||||
dbSystem.getDatabase().executeTransaction(new OperatorStatusTransaction(playerUUID, operator));
|
||||
} 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));
|
||||
} 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 {
|
||||
actOnJoinEvent(event);
|
||||
} 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 {
|
||||
actOnQuitEvent(event);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,8 @@ import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.settings.config.WorldAliasSettings;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Optional;
|
||||
@ -40,19 +40,19 @@ public class WorldChangeListener implements Listener {
|
||||
private final WorldAliasSettings worldAliasSettings;
|
||||
private final ServerInfo serverInfo;
|
||||
private final DBSystem dbSystem;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public WorldChangeListener(
|
||||
WorldAliasSettings worldAliasSettings,
|
||||
ServerInfo serverInfo,
|
||||
DBSystem dbSystem,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.worldAliasSettings = worldAliasSettings;
|
||||
this.serverInfo = serverInfo;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -61,7 +61,7 @@ public class WorldChangeListener implements Listener {
|
||||
try {
|
||||
actOnEvent(event);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,12 +36,10 @@ import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.debug.CombineDebugLogger;
|
||||
import com.djrapitops.plugin.logging.debug.DebugLogger;
|
||||
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.task.RunnableFactory;
|
||||
import com.djrapitops.plugin.task.nukkit.NukkitRunnableFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -54,7 +52,6 @@ import java.util.Map;
|
||||
public class NukkitPlugin extends PluginBase implements APFPlugin {
|
||||
|
||||
protected final CombineDebugLogger debugLogger;
|
||||
protected final DefaultErrorHandler errorHandler;
|
||||
protected final Timings timings;
|
||||
protected final RunnableFactory runnableFactory;
|
||||
private final Map<String, CommandNode> commands;
|
||||
@ -82,7 +79,6 @@ public class NukkitPlugin extends PluginBase implements APFPlugin {
|
||||
this::getDebugLogger,
|
||||
this::getLogger
|
||||
);
|
||||
this.errorHandler = new DefaultErrorHandler(this, logger, new File(getDataFolder(), "logs"));
|
||||
commands = new HashMap<>();
|
||||
}
|
||||
|
||||
@ -153,8 +149,9 @@ public class NukkitPlugin extends PluginBase implements APFPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public ErrorHandler getErrorHandler() {
|
||||
return errorHandler;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -168,9 +165,7 @@ public class NukkitPlugin extends PluginBase implements APFPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorHandlers(ErrorHandler... errorHandlers) {
|
||||
errorHandler.setErrorHandlers(errorHandlers);
|
||||
}
|
||||
public void setErrorHandlers(ErrorHandler... errorHandlers) { }
|
||||
|
||||
@Override
|
||||
public void onReload() {
|
||||
|
@ -21,8 +21,8 @@ import cn.nukkit.event.player.PlayerMoveEvent;
|
||||
import com.djrapitops.plan.gathering.listeners.nukkit.NukkitAFKListener;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.settings.config.paths.TimeSettings;
|
||||
import com.djrapitops.plugin.logging.console.TestPluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ConsoleErrorLogger;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
@ -43,12 +43,19 @@ import static org.mockito.Mockito.*;
|
||||
public class NukkitAFKListenerTest {
|
||||
|
||||
private static NukkitAFKListener underTest;
|
||||
private static ErrorLogger errorLogger;
|
||||
|
||||
@BeforeAll
|
||||
static void setUp() {
|
||||
PlanConfig config = Mockito.mock(PlanConfig.class);
|
||||
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
|
||||
|
@ -8,6 +8,7 @@ blossom {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly project(":common")
|
||||
compile project(path: ":common", configuration: 'shadow')
|
||||
compileOnly project(":api")
|
||||
|
||||
|
@ -19,8 +19,8 @@ package com.djrapitops.plan;
|
||||
import com.djrapitops.plan.gathering.ServerShutdownSave;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
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.error.ErrorHandler;
|
||||
import org.spongepowered.api.GameState;
|
||||
import org.spongepowered.api.event.Listener;
|
||||
import org.spongepowered.api.event.Order;
|
||||
@ -44,9 +44,9 @@ public class SpongeServerShutdownSave extends ServerShutdownSave {
|
||||
Locale locale,
|
||||
DBSystem dbSystem,
|
||||
PluginLogger logger,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
super(locale, dbSystem, logger, errorHandler);
|
||||
super(locale, dbSystem, logger, errorLogger);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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.Database;
|
||||
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.error.ErrorHandler;
|
||||
import org.spongepowered.api.Sponge;
|
||||
import org.spongepowered.api.data.key.Keys;
|
||||
import org.spongepowered.api.entity.living.player.Player;
|
||||
@ -72,7 +72,7 @@ public class PlayerOnlineListener {
|
||||
private final NicknameCache nicknameCache;
|
||||
private final SessionCache sessionCache;
|
||||
private final Status status;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public PlayerOnlineListener(
|
||||
@ -85,7 +85,7 @@ public class PlayerOnlineListener {
|
||||
NicknameCache nicknameCache,
|
||||
SessionCache sessionCache,
|
||||
Status status,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.config = config;
|
||||
this.processing = processing;
|
||||
@ -97,7 +97,7 @@ public class PlayerOnlineListener {
|
||||
this.nicknameCache = nicknameCache;
|
||||
this.sessionCache = sessionCache;
|
||||
this.status = status;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Listener(order = Order.POST)
|
||||
@ -105,7 +105,7 @@ public class PlayerOnlineListener {
|
||||
try {
|
||||
actOnLoginEvent(event);
|
||||
} 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));
|
||||
} 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 {
|
||||
actOnJoinEvent(event);
|
||||
} 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 {
|
||||
actOnQuitEvent(event);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,8 @@ package com.djrapitops.plan.gathering.listeners.sponge;
|
||||
import com.djrapitops.plan.gathering.afk.AFKTracker;
|
||||
import com.djrapitops.plan.settings.Permissions;
|
||||
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.error.ErrorHandler;
|
||||
import org.spongepowered.api.entity.living.player.Player;
|
||||
import org.spongepowered.api.event.Listener;
|
||||
import org.spongepowered.api.event.Order;
|
||||
@ -51,11 +51,11 @@ public class SpongeAFKListener {
|
||||
static AFKTracker AFK_TRACKER;
|
||||
|
||||
private final Map<UUID, Boolean> ignorePermissionInfo;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public SpongeAFKListener(PlanConfig config, ErrorHandler errorHandler) {
|
||||
this.errorHandler = errorHandler;
|
||||
public SpongeAFKListener(PlanConfig config, ErrorLogger errorLogger) {
|
||||
this.errorLogger = errorLogger;
|
||||
this.ignorePermissionInfo = new HashMap<>();
|
||||
|
||||
SpongeAFKListener.assignAFKTracker(config);
|
||||
@ -71,7 +71,7 @@ public class SpongeAFKListener {
|
||||
try {
|
||||
performedAction(event.getTargetEntity());
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ import com.djrapitops.plan.gathering.cache.NicknameCache;
|
||||
import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
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.error.ErrorHandler;
|
||||
import org.spongepowered.api.entity.living.player.Player;
|
||||
import org.spongepowered.api.event.Listener;
|
||||
import org.spongepowered.api.event.Order;
|
||||
@ -42,19 +42,19 @@ public class SpongeChatListener {
|
||||
private final ServerInfo serverInfo;
|
||||
private final DBSystem dbSystem;
|
||||
private final NicknameCache nicknameCache;
|
||||
private ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public SpongeChatListener(
|
||||
ServerInfo serverInfo,
|
||||
DBSystem dbSystem,
|
||||
NicknameCache nicknameCache,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.serverInfo = serverInfo;
|
||||
this.dbSystem = dbSystem;
|
||||
this.nicknameCache = nicknameCache;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Listener(order = Order.POST)
|
||||
@ -66,7 +66,7 @@ public class SpongeChatListener {
|
||||
try {
|
||||
actOnChatEvent(player);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,8 @@ import com.djrapitops.plan.gathering.domain.Session;
|
||||
import com.djrapitops.plan.processing.Processing;
|
||||
import com.djrapitops.plan.processing.processors.player.MobKillProcessor;
|
||||
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.error.ErrorHandler;
|
||||
import org.spongepowered.api.data.key.Keys;
|
||||
import org.spongepowered.api.data.type.HandTypes;
|
||||
import org.spongepowered.api.entity.Entity;
|
||||
@ -52,15 +52,15 @@ import java.util.UUID;
|
||||
public class SpongeDeathListener {
|
||||
|
||||
private final Processing processing;
|
||||
private ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public SpongeDeathListener(
|
||||
Processing processing,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.processing = processing;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Listener
|
||||
@ -81,7 +81,7 @@ public class SpongeDeathListener {
|
||||
handleKill(time, dead, killerEntity);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,8 @@ import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.settings.config.WorldAliasSettings;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
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.error.ErrorHandler;
|
||||
import org.spongepowered.api.entity.living.player.Player;
|
||||
import org.spongepowered.api.event.Listener;
|
||||
import org.spongepowered.api.event.Order;
|
||||
@ -43,19 +43,19 @@ public class SpongeGMChangeListener {
|
||||
private final WorldAliasSettings worldAliasSettings;
|
||||
private final ServerInfo serverInfo;
|
||||
private final DBSystem dbSystem;
|
||||
private ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public SpongeGMChangeListener(
|
||||
WorldAliasSettings worldAliasSettings,
|
||||
ServerInfo serverInfo,
|
||||
DBSystem dbSystem,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.worldAliasSettings = worldAliasSettings;
|
||||
this.serverInfo = serverInfo;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Listener(order = Order.POST)
|
||||
@ -67,7 +67,7 @@ public class SpongeGMChangeListener {
|
||||
try {
|
||||
actOnGMChangeEvent(event);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,8 @@ import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.settings.config.WorldAliasSettings;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
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.error.ErrorHandler;
|
||||
import org.spongepowered.api.data.key.Keys;
|
||||
import org.spongepowered.api.entity.living.player.Player;
|
||||
import org.spongepowered.api.entity.living.player.gamemode.GameMode;
|
||||
@ -46,19 +46,19 @@ public class SpongeWorldChangeListener {
|
||||
private final WorldAliasSettings worldAliasSettings;
|
||||
private final ServerInfo serverInfo;
|
||||
private final DBSystem dbSystem;
|
||||
private ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public SpongeWorldChangeListener(
|
||||
WorldAliasSettings worldAliasSettings,
|
||||
ServerInfo serverInfo,
|
||||
DBSystem dbSystem,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.worldAliasSettings = worldAliasSettings;
|
||||
this.serverInfo = serverInfo;
|
||||
this.dbSystem = dbSystem;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Listener(order = Order.POST)
|
||||
@ -70,7 +70,7 @@ public class SpongeWorldChangeListener {
|
||||
try {
|
||||
actOnEvent(event, player);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
errorLogger.log(L.ERROR, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,9 +20,7 @@ import com.djrapitops.plan.exceptions.EnableException;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.settings.config.paths.DatabaseSettings;
|
||||
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.error.ErrorHandler;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -44,9 +42,7 @@ public class SpongeDBSystem extends DBSystem {
|
||||
SQLiteDB.Factory sqLiteDB,
|
||||
H2DB.Factory h2DB,
|
||||
PlanConfig config,
|
||||
PluginLogger logger,
|
||||
Timings timings,
|
||||
ErrorHandler errorHandler
|
||||
PluginLogger logger
|
||||
) {
|
||||
super(locale, sqLiteDB, h2DB, logger);
|
||||
this.config = config;
|
||||
|
@ -8,6 +8,7 @@ blossom {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly project(":common")
|
||||
compile project(path: ":common", configuration: 'shadow')
|
||||
compileOnly project(":api")
|
||||
|
||||
|
@ -34,8 +34,8 @@ import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.transactions.events.GeoInfoStoreTransaction;
|
||||
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.error.ErrorHandler;
|
||||
import com.velocitypowered.api.event.PostOrder;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
||||
@ -66,7 +66,7 @@ public class PlayerOnlineListener {
|
||||
private final GeolocationCache geolocationCache;
|
||||
private final SessionCache sessionCache;
|
||||
private final ServerInfo serverInfo;
|
||||
private final ErrorHandler errorHandler;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
@Inject
|
||||
public PlayerOnlineListener(
|
||||
@ -74,10 +74,11 @@ public class PlayerOnlineListener {
|
||||
Processing processing,
|
||||
DBSystem dbSystem,
|
||||
ExtensionSvc extensionService,
|
||||
Exporter exporter, GeolocationCache geolocationCache,
|
||||
Exporter exporter,
|
||||
GeolocationCache geolocationCache,
|
||||
SessionCache sessionCache,
|
||||
ServerInfo serverInfo,
|
||||
ErrorHandler errorHandler
|
||||
ErrorLogger errorLogger
|
||||
) {
|
||||
this.config = config;
|
||||
this.processing = processing;
|
||||
@ -87,7 +88,7 @@ public class PlayerOnlineListener {
|
||||
this.geolocationCache = geolocationCache;
|
||||
this.sessionCache = sessionCache;
|
||||
this.serverInfo = serverInfo;
|
||||
this.errorHandler = errorHandler;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
@Subscribe(order = PostOrder.LAST)
|
||||
@ -95,7 +96,7 @@ public class PlayerOnlineListener {
|
||||
try {
|
||||
actOnLogin(event);
|
||||
} 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 {
|
||||
actOnLogout(event);
|
||||
} 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 {
|
||||
actOnServerSwitch(event);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.WARN, this.getClass(), e);
|
||||
errorLogger.log(L.WARN, this.getClass(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user