This commit is contained in:
sgdc3 2018-02-04 15:12:23 +01:00
parent 74c06346d8
commit 6a5f335e16
2 changed files with 25 additions and 0 deletions

View File

@ -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()) {

View File

@ -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.
*