diff --git a/src/main/java/fr/xephi/authme/settings/SettingsWarner.java b/src/main/java/fr/xephi/authme/settings/SettingsWarner.java index 176dca9c9..ca049d56b 100644 --- a/src/main/java/fr/xephi/authme/settings/SettingsWarner.java +++ b/src/main/java/fr/xephi/authme/settings/SettingsWarner.java @@ -5,9 +5,12 @@ import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.security.crypts.Argon2; import fr.xephi.authme.settings.properties.EmailSettings; +import fr.xephi.authme.settings.properties.HooksSettings; import fr.xephi.authme.settings.properties.PluginSettings; import fr.xephi.authme.settings.properties.RestrictionSettings; import fr.xephi.authme.settings.properties.SecuritySettings; +import fr.xephi.authme.util.Utils; +import org.bukkit.Bukkit; import javax.inject.Inject; @@ -50,6 +53,14 @@ public class SettingsWarner { ConsoleLogger.warning("Warning: Session timeout needs to be positive in order to work!"); } + // Warn if spigot.yml has settings.bungeecord set to true but config.yml has Hooks.bungeecord set to false + if (Utils.isSpigot() && Bukkit.spigot().getConfig().getBoolean("settings.bungeecord") + && !settings.getProperty(HooksSettings.BUNGEECORD)) { + ConsoleLogger.warning("Note: Hooks.bungeecord is set to false but your server appears to be running in" + + " bungeecord mode (see your spigot.yml). In order to allow the datasource caching and the AuthMeBungee" + + " add-on to work properly you have to enable this option!"); + } + // Check if argon2 library is present and can be loaded if (settings.getProperty(SecuritySettings.PASSWORD_HASH).equals(HashAlgorithm.ARGON2) && !Argon2.isLibraryLoaded()) { diff --git a/src/main/java/fr/xephi/authme/util/Utils.java b/src/main/java/fr/xephi/authme/util/Utils.java index 4db7f61bc..8146f4e25 100644 --- a/src/main/java/fr/xephi/authme/util/Utils.java +++ b/src/main/java/fr/xephi/authme/util/Utils.java @@ -22,6 +22,20 @@ public final class Utils { private Utils() { } + /** + * Returns if the running server instance is craftbukkit or spigot based. + * + * @return true if the running server instance is spigot-based. + */ + public static boolean isSpigot() { + try { + Class.forName("org.spigotmc.SpigotConfig"); + } catch (ClassNotFoundException e) { + return false; + } + return true; + } + /** * Compile Pattern sneaky without throwing Exception. *