the parameters type
*/
abstract class AbstractPasswordRegisterExecutor
- implements RegistrationExecutor
{
+ implements RegistrationExecutor
{
/**
* Number of ticks to wait before running the login action when it is run synchronously.
@@ -51,7 +51,7 @@ abstract class AbstractPasswordRegisterExecutor
asynchronousLogin.forceLogin(player));
} else {
bukkitService.scheduleSyncDelayedTask(() -> asynchronousLogin.forceLogin(player), SYNC_LOGIN_DELAY);
diff --git a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/security/totp/TotpAuthenticator.java b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/security/totp/TotpAuthenticator.java
index 2c787306cb..5f6b62ef83 100644
--- a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/security/totp/TotpAuthenticator.java
+++ b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/security/totp/TotpAuthenticator.java
@@ -10,6 +10,7 @@
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.initialization.HasCleanup;
import fr.xephi.authme.settings.Settings;
+import fr.xephi.authme.settings.properties.CommonSettings;
import fr.xephi.authme.settings.properties.PluginSettings;
import org.bukkit.entity.Player;
@@ -68,7 +69,7 @@ public boolean checkCode(String playerName, String totpKey, String inputCode) {
public TotpGenerationResult generateTotpKey(Player player) {
GoogleAuthenticatorKey credentials = authenticator.createCredentials();
String qrCodeUrl = GoogleAuthenticatorQRGenerator.getOtpAuthURL(
- settings.getProperty(PluginSettings.SERVER_NAME), player.getName(), credentials);
+ settings.getProperty(CommonSettings.SERVER_NAME), player.getName(), credentials);
return new TotpGenerationResult(credentials.getKey(), qrCodeUrl);
}
diff --git a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/BukkitService.java b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/BukkitService.java
index 8a89979558..c9db5e684f 100644
--- a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/BukkitService.java
+++ b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/BukkitService.java
@@ -6,7 +6,7 @@
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.initialization.SettingsDependent;
import fr.xephi.authme.settings.Settings;
-import fr.xephi.authme.settings.properties.PluginSettings;
+import fr.xephi.authme.settings.properties.CommonSettings;
import org.bukkit.BanEntry;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
@@ -35,11 +35,17 @@
*/
public class BukkitService implements SettingsDependent {
- /** Number of ticks per second in the Bukkit main thread. */
+ /**
+ * Number of ticks per second in the Bukkit main thread.
+ */
public static final int TICKS_PER_SECOND = 20;
- /** Number of ticks per minute. */
+ /**
+ * Number of ticks per minute.
+ */
public static final int TICKS_PER_MINUTE = 60 * TICKS_PER_SECOND;
- /** Whether the server is running Folia. */
+ /**
+ * Whether the server is running Folia.
+ */
private static final boolean isFolia = UniversalScheduler.isFolia;
private final AuthMe authMe;
private boolean useAsyncTasks;
@@ -121,6 +127,7 @@ public void runTask(Location location, Runnable task) {
/**
* Runs the task synchronously if we are running Folia, else do nothing but run it.
+ *
* @param task the task to be run
*/
public void runTaskIfFolia(Runnable task) {
@@ -133,6 +140,7 @@ public void runTaskIfFolia(Runnable task) {
/**
* Runs the task synchronously if we are running Folia, else do nothing but run it.
+ *
* @param task the task to be run
*/
public void runTaskIfFolia(Entity entity, Runnable task) {
@@ -145,6 +153,7 @@ public void runTaskIfFolia(Entity entity, Runnable task) {
/**
* Runs the task synchronously if we are running Folia, else do nothing but run it.
+ *
* @param task the task to be run
*/
public void runTaskIfFolia(Location location, Runnable task) {
@@ -212,13 +221,13 @@ public void runTaskAsynchronously(Runnable task) {
* Returns a task that will repeatedly run asynchronously until cancelled,
* starting after the specified number of server ticks.
*
- * @param task the task to be run
- * @param delay the ticks to wait before running the task for the first
- * time
+ * @param task the task to be run
+ * @param delay the ticks to wait before running the task for the first
+ * time
* @param period the ticks to wait between runs
* @return a BukkitTask that contains the id number
* @throws IllegalArgumentException if task is null
- * @throws IllegalStateException if this was already scheduled
+ * @throws IllegalStateException if this was already scheduled
*/
public MyScheduledTask runTaskTimerAsynchronously(UniversalRunnable task, long delay, long period) {
return task.runTaskTimerAsynchronously(authMe, delay, period);
@@ -309,7 +318,7 @@ public Collection getOnlinePlayers() {
*
* @param event Event details
* @throws IllegalStateException Thrown when an asynchronous event is
- * fired from synchronous code.
+ * fired from synchronous code.
*/
public void callEvent(Event event) {
Bukkit.getPluginManager().callEvent(event);
@@ -320,7 +329,7 @@ public void callEvent(Event event) {
*
* @param eventSupplier the event supplier: function taking a boolean specifying whether AuthMe is configured
* in async mode or not
- * @param the event type
+ * @param the event type
* @return the event that was created and emitted
*/
public E createAndCallEvent(Function eventSupplier) {
@@ -352,7 +361,7 @@ public World getWorld(String name) {
/**
* Dispatches a command on this server, and executes it if found.
*
- * @param sender the apparent sender of the command
+ * @param sender the apparent sender of the command
* @param commandLine the command + arguments. Example: test abc 123
* @return returns false if no target is found
*/
@@ -372,14 +381,14 @@ public boolean dispatchConsoleCommand(String commandLine) {
@Override
public void reload(Settings settings) {
- useAsyncTasks = settings.getProperty(PluginSettings.USE_ASYNC_TASKS);
+ useAsyncTasks = settings.getProperty(CommonSettings.USE_ASYNC_TASKS);
}
/**
* Send the specified bytes to bungeecord using the specified player connection.
*
* @param player the player
- * @param bytes the message
+ * @param bytes the message
*/
public void sendBungeeMessage(Player player, byte[] bytes) {
player.sendPluginMessage(authMe, "BungeeCord", bytes);
@@ -389,7 +398,7 @@ public void sendBungeeMessage(Player player, byte[] bytes) {
* Send the specified bytes to bungeecord using the specified player connection.
*
* @param player the player
- * @param bytes the message
+ * @param bytes the message
*/
public void sendVelocityMessage(Player player, byte[] bytes) {
if (player != null) {
@@ -404,13 +413,13 @@ public void sendVelocityMessage(Player player, byte[] bytes) {
* Adds a ban to the list. If a previous ban exists, this will
* update the previous entry.
*
- * @param ip the ip of the ban
- * @param reason reason for the ban, null indicates implementation default
+ * @param ip the ip of the ban
+ * @param reason reason for the ban, null indicates implementation default
* @param expires date for the ban's expiration (unban), or null to imply
- * forever
- * @param source source of the ban, null indicates implementation default
+ * forever
+ * @param source source of the ban, null indicates implementation default
* @return the entry for the newly created ban, or the entry for the
- * (updated) previous ban
+ * (updated) previous ban
*/
public BanEntry banIp(String ip, String reason, Date expires, String source) {
return Bukkit.getServer().getBanList(BanList.Type.IP).addBan(ip, reason, expires, source);
diff --git a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/HelpTranslationGenerator.java b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/HelpTranslationGenerator.java
index e1c8c5ba76..ffd9d1f60d 100644
--- a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/HelpTranslationGenerator.java
+++ b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/HelpTranslationGenerator.java
@@ -11,6 +11,7 @@
import fr.xephi.authme.message.MessagePathHelper;
import fr.xephi.authme.permission.DefaultPermission;
import fr.xephi.authme.settings.Settings;
+import fr.xephi.authme.settings.properties.CommonSettings;
import fr.xephi.authme.settings.properties.PluginSettings;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
@@ -49,7 +50,7 @@ public class HelpTranslationGenerator {
* @throws IOException if the help file cannot be written to
*/
public File updateHelpFile() throws IOException {
- String languageCode = settings.getProperty(PluginSettings.MESSAGES_LANGUAGE);
+ String languageCode = settings.getProperty(CommonSettings.MESSAGES_LANGUAGE);
File helpFile = new File(dataFolder, MessagePathHelper.createHelpMessageFilePath(languageCode));
Map helpEntries = generateHelpMessageEntries();
diff --git a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/SessionService.java b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/SessionService.java
index 70589f77ac..47c47ead72 100644
--- a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/SessionService.java
+++ b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/service/SessionService.java
@@ -7,6 +7,7 @@
import fr.xephi.authme.initialization.Reloadable;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.logger.ConsoleLoggerFactory;
+import fr.xephi.authme.settings.properties.CommonSettings;
import fr.xephi.authme.settings.properties.PluginSettings;
import fr.xephi.authme.util.PlayerUtils;
import org.bukkit.entity.Player;
@@ -78,7 +79,7 @@ private SessionState fetchSessionStatus(PlayerAuth auth, Player player) {
long timeSinceLastLogin = System.currentTimeMillis() - auth.getLastLogin();
if (timeSinceLastLogin > 0
- && timeSinceLastLogin < service.getProperty(PluginSettings.SESSIONS_TIMEOUT) * MILLIS_PER_MINUTE) {
+ && timeSinceLastLogin < service.getProperty(CommonSettings.SESSIONS_TIMEOUT) * MILLIS_PER_MINUTE) {
if (PlayerUtils.getPlayerIp(player).equals(auth.getLastIp())) {
return SessionState.VALID;
} else {
@@ -100,6 +101,6 @@ public void revokeSession(String name) {
@Override
public void reload() {
- this.isEnabled = service.getProperty(PluginSettings.SESSIONS_ENABLED);
+ this.isEnabled = service.getProperty(CommonSettings.SESSIONS_ENABLED);
}
}
diff --git a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java
index bd28b7a5ef..8bb297a215 100644
--- a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java
+++ b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java
@@ -13,6 +13,7 @@
import fr.xephi.authme.process.register.RegisterSecondaryArgument;
import fr.xephi.authme.process.register.RegistrationType;
import fr.xephi.authme.security.HashAlgorithm;
+import fr.xephi.authme.settings.properties.CommonSettings;
import fr.xephi.authme.settings.properties.DatabaseSettings;
import fr.xephi.authme.settings.properties.PluginSettings;
import fr.xephi.authme.settings.properties.RegistrationSettings;
@@ -222,7 +223,7 @@ private static boolean migratePoolSizeSetting(PropertyReader reader, Configurati
private static boolean changeBooleanSettingToLogLevelProperty(PropertyReader reader,
ConfigurationData configData) {
final String oldPath = "Security.console.noConsoleSpam";
- final Property newProperty = PluginSettings.LOG_LEVEL;
+ final Property newProperty = CommonSettings.LOG_LEVEL;
if (!newProperty.isValidInResource(reader) && reader.contains(oldPath)) {
logger.info("Moving '" + oldPath + "' to '" + newProperty.getPath() + "'");
boolean oldValue = Optional.ofNullable(reader.getBoolean(oldPath)).orElse(false);
diff --git a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/SettingsWarner.java b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/SettingsWarner.java
index 8626e7a410..4f2e1ad3ac 100644
--- a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/SettingsWarner.java
+++ b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/SettingsWarner.java
@@ -6,6 +6,7 @@
import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.security.crypts.Argon2;
import fr.xephi.authme.service.BukkitService;
+import fr.xephi.authme.settings.properties.CommonSettings;
import fr.xephi.authme.settings.properties.EmailSettings;
import fr.xephi.authme.settings.properties.HooksSettings;
import fr.xephi.authme.settings.properties.PluginSettings;
@@ -54,8 +55,8 @@ public void logWarningsForMisconfigurations() {
}
// Output hint if sessions are enabled that the timeout must be positive
- if (settings.getProperty(PluginSettings.SESSIONS_ENABLED)
- && settings.getProperty(PluginSettings.SESSIONS_TIMEOUT) <= 0) {
+ if (settings.getProperty(CommonSettings.SESSIONS_ENABLED)
+ && settings.getProperty(CommonSettings.SESSIONS_TIMEOUT) <= 0) {
logger.warning("Warning: Session timeout needs to be positive in order to work!");
}
diff --git a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/properties/AuthMeSettingsRetriever.java b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/properties/AuthMeSettingsRetriever.java
index 9ddf9aa1a8..d8ac55a338 100644
--- a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/properties/AuthMeSettingsRetriever.java
+++ b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/properties/AuthMeSettingsRetriever.java
@@ -20,9 +20,11 @@ private AuthMeSettingsRetriever() {
*/
public static ConfigurationData buildConfigurationData() {
return ConfigurationDataBuilder.createConfiguration(
+ CommonSettings.class,
DatabaseSettings.class, PluginSettings.class, RestrictionSettings.class,
EmailSettings.class, HooksSettings.class, ProtectionSettings.class,
PurgeSettings.class, SecuritySettings.class, RegistrationSettings.class,
LimboSettings.class, BackupSettings.class, ConverterSettings.class);
}
+
}
diff --git a/project/module-common/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java
similarity index 69%
rename from project/module-common/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java
rename to plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java
index b06e7a88eb..fa5a740f7a 100644
--- a/project/module-common/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java
+++ b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/settings/properties/PluginSettings.java
@@ -40,32 +40,6 @@ public final class PluginSettings implements SettingsHolder {
newLowercaseStringSetProperty("3rdPartyFeature.features.i18nMessages.locale-code-redirect",
"tt_ru:ru", "lzh:zhcn");
- @Comment({
- "Do you want to enable the session feature?",
- "If enabled, when a player authenticates successfully,",
- "his IP and his nickname is saved.",
- "The next time the player joins the server, if his IP",
- "is the same as last time and the timeout hasn't",
- "expired, he will not need to authenticate."
- })
- public static final Property SESSIONS_ENABLED =
- newProperty("settings.sessions.enabled", true);
-
- @Comment({
- "After how many minutes should a session expire?",
- "A player's session ends after the timeout or if his IP has changed"
- })
- public static final Property SESSIONS_TIMEOUT =
- newProperty("settings.sessions.timeout", 43200);
-
- @Comment({
- "Message language, available languages:",
- "https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/translations.md",
- "Example: zhcn, en"
- })
- public static final Property MESSAGES_LANGUAGE =
- newProperty("settings.messagesLanguage", "en");
-
@Comment({
"Enables switching a player to defined permission groups before they log in.",
"See below for a detailed explanation."
@@ -99,21 +73,6 @@ public final class PluginSettings implements SettingsHolder {
public static final Property FORCE_VAULT_HOOK =
newProperty("settings.forceVaultHook", false);
- @Comment({
- "Log level: INFO, FINE, DEBUG. Use INFO for general messages,",
- "FINE for some additional detailed ones (like password failed),",
- "and DEBUG for debugging"
- })
- public static final Property LOG_LEVEL =
- newProperty(LogLevel.class, "settings.logLevel", LogLevel.FINE);
-
- @Comment({
- "By default we schedule async tasks when talking to the database. If you want",
- "typical communication with the database to happen synchronously, set this to false"
- })
- public static final Property USE_ASYNC_TASKS =
- newProperty("settings.useAsyncTasks", true);
-
@Comment("The name of the server, used in some placeholders.")
public static final Property SERVER_NAME = newProperty("settings.serverName", "Your Minecraft Server");
diff --git a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/util/message/I18NUtils.java b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/util/message/I18NUtils.java
index da1d6769bc..b2547bb4c6 100644
--- a/plugin/platform-bukkit/src/main/java/fr/xephi/authme/util/message/I18NUtils.java
+++ b/plugin/platform-bukkit/src/main/java/fr/xephi/authme/util/message/I18NUtils.java
@@ -1,6 +1,7 @@
package fr.xephi.authme.util.message;
import fr.xephi.authme.settings.Settings;
+import fr.xephi.authme.settings.properties.CommonSettings;
import fr.xephi.authme.settings.properties.PluginSettings;
import fr.xephi.authme.util.Utils;
import org.bukkit.entity.Player;
@@ -97,6 +98,6 @@ public static String localeToCode(String locale, Settings settings) {
return locale;
}
- return settings.getProperty(PluginSettings.MESSAGES_LANGUAGE);
+ return settings.getProperty(CommonSettings.MESSAGES_LANGUAGE);
}
}
diff --git a/project/module-common/src/main/java/fr/xephi/authme/settings/properties/CommonSettings.java b/project/module-common/src/main/java/fr/xephi/authme/settings/properties/CommonSettings.java
new file mode 100644
index 0000000000..9029bdbd46
--- /dev/null
+++ b/project/module-common/src/main/java/fr/xephi/authme/settings/properties/CommonSettings.java
@@ -0,0 +1,62 @@
+package fr.xephi.authme.settings.properties;
+
+import ch.jalu.configme.Comment;
+import ch.jalu.configme.SettingsHolder;
+import ch.jalu.configme.properties.Property;
+import fr.xephi.authme.logger.LogLevel;
+
+import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
+
+/**
+ * CommonSettings
+ *
+ * @author TheFloodDragon
+ * @since 2024/7/11 20:19
+ */
+public final class CommonSettings implements SettingsHolder {
+
+ @Comment({
+ "Message language, available languages:",
+ "https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/translations.md",
+ "Example: zhcn, en"
+ })
+ public static final Property MESSAGES_LANGUAGE =
+ newProperty("settings.messagesLanguage", "en");
+
+ @Comment({
+ "(Disabled since 2024.7.11) Log level: INFO, FINE, DEBUG. Use INFO for general messages,",
+ "FINE for some additional detailed ones (like password failed),",
+ "and DEBUG for debugging"
+ })
+ public static final Property LOG_LEVEL =
+ newProperty(LogLevel.class, "settings.logLevel", LogLevel.FINE);
+
+ @Comment({
+ "By default we schedule async tasks when talking to the database. If you want",
+ "typical communication with the database to happen synchronously, set this to false"
+ })
+ public static final Property USE_ASYNC_TASKS =
+ newProperty("settings.useAsyncTasks", true);
+
+ @Comment({
+ "Do you want to enable the session feature?",
+ "If enabled, when a player authenticates successfully,",
+ "his IP and his nickname is saved.",
+ "The next time the player joins the server, if his IP",
+ "is the same as last time and the timeout hasn't",
+ "expired, he will not need to authenticate."
+ })
+ public static final Property SESSIONS_ENABLED =
+ newProperty("settings.sessions.enabled", true);
+
+ @Comment({
+ "After how many minutes should a session expire?",
+ "A player's session ends after the timeout or if his IP has changed"
+ })
+ public static final Property SESSIONS_TIMEOUT =
+ newProperty("settings.sessions.timeout", 43200);
+
+ @Comment("The name of the server, used in some placeholders.")
+ public static final Property SERVER_NAME = newProperty("settings.serverName", "Your Minecraft Server");
+
+}
diff --git a/project/module-mail/build.gradle.kts b/project/module-mail/build.gradle.kts
index 599734c92c..7b1860d873 100644
--- a/project/module-mail/build.gradle.kts
+++ b/project/module-mail/build.gradle.kts
@@ -1,6 +1,7 @@
dependencies {
compileOnly(project(":project:module-logger"))
compileOnly(project(":project:module-util"))
+ compileOnly(project(":project:module-security"))
compileOnly(libs.configme)
compileOnly(libs.jalu.injector)
// Java Email Library
diff --git a/project/module-mail/src/main/java/fr/xephi/authme/mail/EmailService.java b/project/module-mail/src/main/java/fr/xephi/authme/mail/EmailService.java
index 400119dca0..87f9da31c1 100644
--- a/project/module-mail/src/main/java/fr/xephi/authme/mail/EmailService.java
+++ b/project/module-mail/src/main/java/fr/xephi/authme/mail/EmailService.java
@@ -4,8 +4,8 @@
import fr.xephi.authme.logger.ConsoleLogger;
import fr.xephi.authme.logger.ConsoleLoggerFactory;
import fr.xephi.authme.settings.Settings;
+import fr.xephi.authme.settings.properties.CommonSettings;
import fr.xephi.authme.settings.properties.EmailSettings;
-import fr.xephi.authme.settings.properties.PluginSettings;
import fr.xephi.authme.settings.properties.SecuritySettings;
import fr.xephi.authme.util.FileUtils;
import org.apache.commons.mail.EmailException;
@@ -184,7 +184,7 @@ private static String embedImageIntoEmailContent(File image, HtmlEmail email, St
private String replaceTagsForPasswordMail(String mailText, String name, String newPass, String ip, String time) {
return mailText
.replace("", name)
- .replace("", settings.getProperty(PluginSettings.SERVER_NAME))
+ .replace("", settings.getProperty(CommonSettings.SERVER_NAME))
.replace("", newPass)
.replace("", ip)
.replace("", time);
@@ -193,7 +193,7 @@ private String replaceTagsForPasswordMail(String mailText, String name, String n
private String replaceTagsForPasswordMail(String mailText, String name, String newPass, String time) {
return mailText
.replace("", name)
- .replace("", settings.getProperty(PluginSettings.SERVER_NAME))
+ .replace("", settings.getProperty(CommonSettings.SERVER_NAME))
.replace("", newPass)
.replace("", time);
}
@@ -201,7 +201,7 @@ private String replaceTagsForPasswordMail(String mailText, String name, String n
private String replaceTagsForVerificationEmail(String mailText, String name, String code, int minutesValid, String time) {
return mailText
.replace("", name)
- .replace("", settings.getProperty(PluginSettings.SERVER_NAME))
+ .replace("", settings.getProperty(CommonSettings.SERVER_NAME))
.replace("", code)
.replace("", String.valueOf(minutesValid))
.replace("", time);
@@ -210,7 +210,7 @@ private String replaceTagsForVerificationEmail(String mailText, String name, Str
private String replaceTagsForRecoveryCodeMail(String mailText, String name, String code, int hoursValid, String time) {
return mailText
.replace("", name)
- .replace("", settings.getProperty(PluginSettings.SERVER_NAME))
+ .replace("", settings.getProperty(CommonSettings.SERVER_NAME))
.replace("", code)
.replace("", String.valueOf(hoursValid))
.replace("", time);
@@ -218,7 +218,7 @@ private String replaceTagsForRecoveryCodeMail(String mailText, String name, Stri
private String replaceTagsForShutDownMail(String mailText, String time) {
return mailText
- .replace("", settings.getProperty(PluginSettings.SERVER_NAME))
+ .replace("", settings.getProperty(CommonSettings.SERVER_NAME))
.replace("", time);
}
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 ca5eb3a5bd..f0b6b05250 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
@@ -4,6 +4,7 @@
import fr.xephi.authme.logger.ConsoleLoggerFactory;
import fr.xephi.authme.logger.LogLevel;
import fr.xephi.authme.settings.Settings;
+import fr.xephi.authme.settings.properties.CommonSettings;
import fr.xephi.authme.settings.properties.EmailSettings;
import fr.xephi.authme.settings.properties.PluginSettings;
import fr.xephi.authme.util.StringUtils;
@@ -66,7 +67,7 @@ public HtmlEmail initializeMail(String emailAddress) throws EmailException {
email.setFrom(senderMail, senderName);
email.setSubject(settings.getProperty(EmailSettings.RECOVERY_MAIL_SUBJECT));
email.setAuthentication(settings.getProperty(EmailSettings.MAIL_ACCOUNT), mailPassword);
- if (settings.getProperty(PluginSettings.LOG_LEVEL).includes(LogLevel.DEBUG)) {
+ if (settings.getProperty(CommonSettings.LOG_LEVEL).includes(LogLevel.DEBUG)) {
email.setDebug(true);
}
diff --git a/project/module-util/build.gradle.kts b/project/module-util/build.gradle.kts
index bf78ed70ed..0b09dba6c1 100644
--- a/project/module-util/build.gradle.kts
+++ b/project/module-util/build.gradle.kts
@@ -1,5 +1,4 @@
dependencies {
- compileOnly(project(":project:module-logger"))
compileOnly(libs.guava)
// String comparison library. Used for dynamic help system.
implementation("net.ricecode:string-similarity:1.0.0")
diff --git a/project/module-util/src/main/java/fr/xephi/authme/util/FileUtils.java b/project/module-util/src/main/java/fr/xephi/authme/util/FileUtils.java
index c111c01327..9acf896e71 100644
--- a/project/module-util/src/main/java/fr/xephi/authme/util/FileUtils.java
+++ b/project/module-util/src/main/java/fr/xephi/authme/util/FileUtils.java
@@ -1,8 +1,6 @@
package fr.xephi.authme.util;
import com.google.common.io.Files;
-import fr.xephi.authme.logger.ConsoleLogger;
-import fr.xephi.authme.logger.ConsoleLoggerFactory;
import java.io.File;
import java.io.IOException;
@@ -10,8 +8,6 @@
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
-import static java.lang.String.format;
-
/**
* File utilities.
*/
@@ -20,8 +16,6 @@ public final class FileUtils {
private static final DateTimeFormatter CURRENT_DATE_STRING_FORMATTER =
DateTimeFormatter.ofPattern("yyyyMMdd_HHmm");
- private static ConsoleLogger logger = ConsoleLoggerFactory.get(FileUtils.class);
-
// Utility class
private FileUtils() {
}
@@ -37,21 +31,20 @@ public static boolean copyFileFromResource(File destinationFile, String resource
if (destinationFile.exists()) {
return true;
} else if (!createDirectory(destinationFile.getParentFile())) {
- logger.warning("Cannot create parent directories for '" + destinationFile + "'");
+ System.out.println("[warning] Cannot create parent directories for '" + destinationFile + "'");
return false;
}
try (InputStream is = getResourceFromJar(resourcePath)) {
if (is == null) {
- logger.warning(format("Cannot copy resource '%s' to file '%s': cannot load resource",
- resourcePath, destinationFile.getPath()));
+ System.out.printf("[warning] Cannot copy resource '%s' to file '%s': cannot load resource%n", resourcePath, destinationFile.getPath());
} else {
java.nio.file.Files.copy(is, destinationFile.toPath());
return true;
}
} catch (IOException e) {
- logger.logException(format("Cannot copy resource '%s' to file '%s':",
- resourcePath, destinationFile.getPath()), e);
+ System.out.printf("[warning] Cannot copy resource '%s' to file '%s':%n", resourcePath, destinationFile.getPath());
+ e.printStackTrace();
}
return false;
}
@@ -64,7 +57,7 @@ public static boolean copyFileFromResource(File destinationFile, String resource
*/
public static boolean createDirectory(File dir) {
if (!dir.exists() && !dir.mkdirs()) {
- logger.warning("Could not create directory '" + dir + "'");
+ System.out.println("[warning] Could not create directory '" + dir + "'");
return false;
}
return dir.isDirectory();
@@ -121,7 +114,7 @@ public static void delete(File file) {
if (file != null) {
boolean result = file.delete();
if (!result) {
- logger.warning("Could not delete file '" + file + "'");
+ System.out.println("[warning] Could not delete file '" + file + "'");
}
}
}