diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 45100e11..8274b819 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -21,17 +21,21 @@ subprojects { dependencies { // Modules - implementation(project(":project:module-configuration", "shadow")) - implementation(project(":project:module-logger", "shadow")) - implementation(project(":project:module-util", "shadow")) - implementation(project(":project:module-security", "shadow")) - implementation(project(":project:module-common", "shadow")) - implementation(project(":project:module-message", "shadow")) - implementation(project(":project:module-database", "shadow")) - implementation(project(":project:module-mail", "shadow")) + implementation(project(":project:module-configuration")) + implementation(project(":project:module-logger")) + implementation(project(":project:module-util")) + implementation(project(":project:module-security")) + implementation(project(":project:module-common")) + implementation(project(":project:module-message")) + implementation(project(":project:module-database")) + implementation(project(":project:module-mail")) // Adventure API implementation(rootProject.libs.adventure.text.minimessage) implementation(rootProject.libs.adventure.text.serializer.gson) + // ConfigMe + implementation(rootProject.libs.configme) { + exclude("org.yaml", "snakeyaml") + } // Spigot API, https://www.spigotmc.org/ compileOnly("org.spigotmc:spigot-api:1.20.6-R0.1-SNAPSHOT") // Java Libraries @@ -45,14 +49,8 @@ subprojects { } // Library for tar archives implementation("javatar:javatar:2.5") - // Log4J Logger (required by the console filter) TODO Remove - compileOnly("org.apache.logging.log4j:log4j-core:2.20.0") // Log4J version bundled in 1.12.2 // Libby implementation("com.alessiodp.libby:libby-bukkit:2.0.0-SNAPSHOT") - // Database Connection Pool TODO Remove - implementation("com.zaxxer:HikariCP:4.0.3" /* Latest java 8 release */) { - exclude("org.slf4j", "slf4j-api") - } // HikariCP Logger implementation("org.slf4j:slf4j-simple:1.7.36") // We can't update to 2.x as long as we use HikariCP for java 8 // MySQL connector, shaded into the legacy jar @@ -65,10 +63,6 @@ subprojects { exclude("org.checkerframework", "checker-qual") } implementation("com.google.code.gson:gson:2.10.1") - // ConfigMe - implementation("ch.jalu:configme:1.3.1") { - exclude("org.yaml", "snakeyaml") - } // Dependencies used by HAProxy feature // implementation("io.netty:netty-codec-haproxy:4.1.104.Final") // compileOnly("commons-validator:commons-validator:1.8.0") @@ -84,7 +78,6 @@ subprojects { compileOnly("net.essentialsx:EssentialsX:2.20.1") // XAuth, another authentication plugin, required by the database converter compileOnly("de.luricos.bukkit:xAuth:2.6.1-SNAPSHOT") - implementation("ch.jalu:datasourcecolumns:0.1.1-SNAPSHOT") // TODO REMOVE implementation("org.postgresql:postgresql:42.7.3") { exclude("org.checkerframework", "checker-qual") } @@ -139,15 +132,28 @@ subprojects { // bStats metrics class relocate("org.bstats", "${project.group}.libs.org.bstats") relocate("org.mariadb.jdbc", "${project.group}.libs.org.mariadb.jdbc") - relocate( - "com.github.Anon8281.universalScheduler", - "${project.group}.libs.com.github.Anon8281.universalScheduler" - ) + relocate("com.github.Anon8281.universalScheduler", "${project.group}.libs.com.github.Anon8281.universalScheduler") relocate("com.mysql", "${project.group}.libs.com.mysql") relocate("com.google.protobuf", "${project.group}.libs.com.google.protobuf") relocate("io.netty", "${project.group}.libs.io.netty") relocate("org.apache.commons.validator", "${project.group}.libs.org.apache.commons.validator") relocate("com.alessiodp.libby", "${project.group}.libs.com.alessiodp.libby") + // Module-Configuration: + // NightConfig + relocate("com.electronwill.nightconfig", "com.electronwill.nightconfig_3_6_7") + // Snakeyaml + relocate("org.yaml.snakeyaml", "org.yaml.snakeyaml_2_2") + // Module-Util: + relocate("net.ricecode.similarity", "${project.group}.libs.net.ricecode.similarity") + // Module-Security: + relocate("de.rtner", "${project.group}.libs.de.rtner") + relocate("at.favre.lib", "${project.group}.libs.at.favre.lib") + relocate("de.mkammerer", "${project.group}.libs.de.mkammerer") + // Module-Mail: + relocate("org.apache.commons", "${project.group}.libs.org.apache.commons") + // Module-Database: + relocate("com.zaxxer.hikari", "${project.group}.libs.com.zaxxer.hikari") + relocate("ch.jalu", "${project.group}.libs.ch.jalu") } } diff --git a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java index 4b7d86f2..a4a0db96 100644 --- a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java +++ b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/command/executable/authme/ReloadCommand.java @@ -2,13 +2,13 @@ package fr.xephi.authme.command.executable.authme; import ch.jalu.injector.factory.SingletonStore; import fr.xephi.authme.AuthMe; -import fr.xephi.authme.logger.ConsoleLogger; import fr.xephi.authme.command.ExecutableCommand; import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.initialization.Reloadable; import fr.xephi.authme.initialization.SettingsDependent; -import fr.xephi.authme.message.MessageKey; +import fr.xephi.authme.logger.ConsoleLogger; import fr.xephi.authme.logger.ConsoleLoggerFactory; +import fr.xephi.authme.message.MessageKey; import fr.xephi.authme.service.CommonService; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.SettingsWarner; @@ -51,7 +51,7 @@ public class ReloadCommand implements ExecutableCommand { public void executeCommand(CommandSender sender, List arguments) { try { settings.reload(); - ConsoleLoggerFactory.reloadSettings(settings); + ConsoleLogger.initialize(); settingsWarner.logWarningsForMisconfigurations(); // We do not change database type for consistency issues, but we'll output a note in the logs @@ -69,9 +69,9 @@ public class ReloadCommand implements ExecutableCommand { private void performReloadOnServices() { reloadableStore.retrieveAllOfType() - .forEach(r -> r.reload()); + .forEach(r -> r.reload()); settingsDependentStore.retrieveAllOfType() - .forEach(s -> s.reload(settings)); + .forEach(s -> s.reload(settings)); } } diff --git a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/BackupService.java b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/BackupService.java index 1e04f599..79b17f00 100644 --- a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/BackupService.java +++ b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/BackupService.java @@ -1,10 +1,10 @@ package fr.xephi.authme.service; -import fr.xephi.authme.logger.ConsoleLogger; import fr.xephi.authme.datasource.DataSourceType; import fr.xephi.authme.initialization.DataFolder; -import fr.xephi.authme.mail.EmailService; +import fr.xephi.authme.logger.ConsoleLogger; import fr.xephi.authme.logger.ConsoleLoggerFactory; +import fr.xephi.authme.mail.EmailService; import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.properties.BackupSettings; import fr.xephi.authme.settings.properties.DatabaseSettings; @@ -39,7 +39,7 @@ public class BackupService { * Constructor. * * @param dataFolder the data folder - * @param settings the plugin settings + * @param settings the plugin settings */ @Inject public BackupService(@DataFolder File dataFolder, Settings settings) { @@ -60,7 +60,7 @@ public class BackupService { /** * Performs a backup for the given reason. * - * @param cause backup reason + * @param cause backup reason * @param sender the command sender (nullable) */ public void doBackup(BackupCause cause, CommandSender sender) { @@ -68,7 +68,7 @@ public class BackupService { // Print a warning if the backup was requested via command or by another plugin if (cause == BackupCause.COMMAND || cause == BackupCause.OTHER) { logAndSendWarning(sender, - "Can't perform a backup: disabled in configuration. Cause of the backup: " + cause.name()); + "Can't perform a backup: disabled in configuration. Cause of the backup: " + cause.name()); } return; } else if (BackupCause.START == cause && !settings.getProperty(BackupSettings.ON_SERVER_START) @@ -80,7 +80,7 @@ public class BackupService { // Do backup and check return value! if (doBackup()) { logAndSendMessage(sender, - "A backup has been performed successfully. Cause of the backup: " + cause.name()); + "A backup has been performed successfully. Cause of the backup: " + cause.name()); } else { logAndSendWarning(sender, "Error while performing a backup! Cause of the backup: " + cause.name()); } @@ -116,8 +116,8 @@ public class BackupService { String backupWindowsPath = settings.getProperty(BackupSettings.MYSQL_WINDOWS_PATH); boolean isUsingWindows = useWindowsCommand(backupWindowsPath); String backupCommand = isUsingWindows - ? backupWindowsPath + "\\bin\\mysqldump.exe" + buildMysqlDumpArguments(sqlBackupFile) - : "mysqldump" + buildMysqlDumpArguments(sqlBackupFile); + ? backupWindowsPath + "\\bin\\mysqldump.exe" + buildMysqlDumpArguments(sqlBackupFile) + : "mysqldump" + buildMysqlDumpArguments(sqlBackupFile); try { Process runtimeProcess = Runtime.getRuntime().exec(backupCommand); @@ -176,11 +176,11 @@ public class BackupService { private String buildMysqlDumpArguments(File sqlBackupFile) { String dbUsername = settings.getProperty(DatabaseSettings.MYSQL_USERNAME); String dbPassword = settings.getProperty(DatabaseSettings.MYSQL_PASSWORD); - String dbName = settings.getProperty(DatabaseSettings.MYSQL_DATABASE); - String tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE); + String dbName = settings.getProperty(DatabaseSettings.MYSQL_DATABASE); + String tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE); return " -u " + dbUsername + " -p" + dbPassword + " " + dbName - + " --tables " + tableName + " -r " + sqlBackupFile.getPath() + ".sql"; + + " --tables " + tableName + " -r " + sqlBackupFile.getPath() + ".sql"; } /** diff --git a/project/module-mail/src/main/java/fr/xephi/authme/mail/SendMailSsl.java b/project/module-mail/src/main/java/fr/xephi/authme/mail/SendMailSsl.java index 5fb36630..fa688f51 100644 --- a/project/module-mail/src/main/java/fr/xephi/authme/mail/SendMailSsl.java +++ b/project/module-mail/src/main/java/fr/xephi/authme/mail/SendMailSsl.java @@ -148,14 +148,15 @@ public class SendMailSsl { } private static @NotNull Properties getProperties(HtmlEmail email, String oAuth2Token) throws EmailException { - Properties mailProperties = email.getMailSession().getProperties(); - mailProperties.setProperty("mail.smtp.ssl.enable", "true"); - mailProperties.setProperty("mail.smtp.auth.mechanisms", "XOAUTH2"); - mailProperties.setProperty("mail.smtp.sasl.enable", "true"); - mailProperties.setProperty("mail.smtp.sasl.mechanisms", "XOAUTH2"); - mailProperties.setProperty("mail.smtp.auth.login.disable", "true"); - mailProperties.setProperty("mail.smtp.auth.plain.disable", "true"); - mailProperties.setProperty(OAuth2SaslClientFactory.OAUTH_TOKEN_PROP, oAuth2Token); - return mailProperties; + Properties p = email.getMailSession().getProperties(); + p.setProperty("mail.smtp.ssl.enable", "true"); + p.setProperty("mail.smtp.auth.mechanisms", "XOAUTH2"); + p.setProperty("mail.smtp.sasl.enable", "true"); + p.setProperty("mail.smtp.sasl.mechanisms", "XOAUTH2"); + p.setProperty("mail.smtp.auth.login.disable", "true"); + p.setProperty("mail.smtp.auth.plain.disable", "true"); + p.setProperty(OAuth2SaslClientFactory.OAUTH_TOKEN_PROP, oAuth2Token); + return p; } + }