diff --git a/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java b/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java index 87a8ef03..eedce464 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java @@ -32,7 +32,7 @@ public class DatabaseSettings implements SettingsClass { @Comment("Password about Database Connection Infos") public static final Property MYSQL_PASSWORD = - newProperty("DataSource.mySQLPassword", "123456"); + newProperty("DataSource.mySQLPassword", "12345"); @Comment("Database Name, use with converters or as SQLITE database name") public static final Property MYSQL_DATABASE = diff --git a/src/main/java/fr/xephi/authme/settings/properties/HooksSettings.java b/src/main/java/fr/xephi/authme/settings/properties/HooksSettings.java index 087bb30d..01e11a9c 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/HooksSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/HooksSettings.java @@ -25,7 +25,7 @@ public class HooksSettings implements SettingsClass { @Comment("Do we need to disable Essentials SocialSpy on join?") public static final Property DISABLE_SOCIAL_SPY = - newProperty("Hooks.disableSocialSpy", false); + newProperty("Hooks.disableSocialSpy", true); @Comment("Do we need to force /motd Essentials command on join?") public static final Property USE_ESSENTIALS_MOTD = diff --git a/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java b/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java index a4792f91..c32245c4 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/ProtectionSettings.java @@ -19,12 +19,12 @@ public class ProtectionSettings implements SettingsClass { @Comment({"Countries allowed to join the server and register, see http://dev.bukkit.org/bukkit-plugins/authme-reloaded/pages/countries-codes/ for countries' codes", "PLEASE USE QUOTES!"}) public static final Property> COUNTRIES_WHITELIST = - newListProperty("Protection.countries", "US", "GB", "A1"); + newListProperty("Protection.countries", "US", "GB"); @Comment({"Countries not allowed to join the server and register", "PLEASE USE QUOTES!"}) public static final Property> COUNTRIES_BLACKLIST = - newListProperty("Protection.countriesBlacklist"); + newListProperty("Protection.countriesBlacklist", "A1"); @Comment("Do we need to enable automatic antibot system?") public static final Property ENABLE_ANTIBOT = diff --git a/src/main/java/fr/xephi/authme/settings/properties/RestrictionSettings.java b/src/main/java/fr/xephi/authme/settings/properties/RestrictionSettings.java index 32173751..96c790e2 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/RestrictionSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/RestrictionSettings.java @@ -31,7 +31,7 @@ public class RestrictionSettings implements SettingsClass { @Comment("Allowed commands for unauthenticated players") public static final Property> ALLOW_COMMANDS = newListProperty("settings.restrictions.allowCommands", - "login", "register", "l", "reg", "email", "captcha"); + "/login", "/register", "/l", "/reg", "/email", "/captcha"); @Comment({ "Max number of allowed registrations per IP", diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index b7640108..8ca9c27f 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -108,12 +108,11 @@ settings: # AllowedRestrctedUser field. AllowRestrictedUser: false # The restricted user feature will kick players listed below - # if they dont match of the defined ip address. + # if they don't match of the defined ip address. # Example: # AllowedRestrictedUser: # - playername;127.0.0.1 - AllowedRestrictedUser: - - playername;127.0.0.1 + AllowedRestrictedUser: [] # Should unregistered players be kicked immediately? kickNonRegistered: false # Should players be kicked on wrong password? @@ -263,11 +262,11 @@ settings: # Do we need to broadcast the welcome message to all server or only to the player? set true for server or false for player broadcastWelcomeMessage: false # Should we delay the join message and display it once the player has logged in? - delayJoinMessage: true + delayJoinMessage: false # Should we remove join messages altogether? - removeJoinMessage: true + removeJoinMessage: false # Should we remove leave messages? - removeLeaveMessage: true + removeLeaveMessage: false # Do we need to add potion effect Blinding before login/register? applyBlindEffect: false # Do we need to prevent people to login with another case? @@ -307,7 +306,7 @@ BackupSystem: # set Backup at every stop of Server OnServerStop: true # Windows only mysql installation Path - MysqlWindowsPath: 'C:\\Program Files\\MySQL\\MySQL Server 5.1\\' + MysqlWindowsPath: 'C:\Program Files\MySQL\MySQL Server 5.1\' Security: SQLProblem: # Stop the server if we can't contact the sql database @@ -360,7 +359,7 @@ Email: # Random password length RecoveryPasswordLength: 8 # Email subject of password get - mailSubject: 'Your new AuthMe Password' + mailSubject: 'Your new AuthMe password' # Like maxRegPerIp but with email maxRegPerEmail: 1 # Recall players to add an email? diff --git a/src/test/java/fr/xephi/authme/settings/ConfigFileConsistencyTest.java b/src/test/java/fr/xephi/authme/settings/ConfigFileConsistencyTest.java index 6a7d7fe1..8d1c7b4e 100644 --- a/src/test/java/fr/xephi/authme/settings/ConfigFileConsistencyTest.java +++ b/src/test/java/fr/xephi/authme/settings/ConfigFileConsistencyTest.java @@ -12,13 +12,14 @@ import org.junit.Test; import java.io.File; import java.io.IOException; -import java.net.URL; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; /** @@ -56,9 +57,8 @@ public class ConfigFileConsistencyTest { @Test public void shouldNotHaveUnknownConfigs() { // given - URL url = this.getClass().getResource(CONFIG_FILE); - File configFile = new File(url.getFile()); - YamlConfiguration configuration = YamlConfiguration.loadConfiguration(configFile); + File configFile = TestHelper.getJarFile(CONFIG_FILE); + FileConfiguration configuration = YamlConfiguration.loadConfiguration(configFile); Map allReadProperties = configuration.getValues(true); Set knownKeys = getAllKnownPropertyPaths(); @@ -78,6 +78,20 @@ public class ConfigFileConsistencyTest { } } + @Test + public void shouldHaveValueCorrespondingToPropertyDefault() { + // given + File configFile = TestHelper.getJarFile(CONFIG_FILE); + FileConfiguration configuration = YamlConfiguration.loadConfiguration(configFile); + PropertyMap propertyMap = SettingsFieldRetriever.getAllPropertyFields(); + + // when / then + for (Property property : propertyMap.keySet()) { + assertThat("Default value of '" + property.getPath() + "' in config.yml should be the same as in Property", + property.getFromFile(configuration), equalTo(property.getDefaultValue())); + } + } + private static Set getAllKnownPropertyPaths() { PropertyMap propertyMap = SettingsFieldRetriever.getAllPropertyFields(); Set paths = new HashSet<>(propertyMap.size());