Move PropertyType functionality into Property class
This commit is contained in:
@@ -5,26 +5,24 @@ import fr.xephi.authme.settings.domain.Property;
|
||||
import fr.xephi.authme.settings.domain.SettingsClass;
|
||||
|
||||
import static fr.xephi.authme.settings.domain.Property.newProperty;
|
||||
import static fr.xephi.authme.settings.domain.PropertyType.BOOLEAN;
|
||||
import static fr.xephi.authme.settings.domain.PropertyType.STRING;
|
||||
|
||||
public class ConverterSettings implements SettingsClass {
|
||||
|
||||
@Comment("Rakamak file name")
|
||||
public static final Property<String> RAKAMAK_FILE_NAME =
|
||||
newProperty(STRING, "Converter.Rakamak.fileName", "users.rak");
|
||||
newProperty("Converter.Rakamak.fileName", "users.rak");
|
||||
|
||||
@Comment("Rakamak use IP?")
|
||||
public static final Property<Boolean> RAKAMAK_USE_IP =
|
||||
newProperty(BOOLEAN, "Converter.Rakamak.useIP", false);
|
||||
newProperty("Converter.Rakamak.useIP", false);
|
||||
|
||||
@Comment("Rakamak IP file name")
|
||||
public static final Property<String> RAKAMAK_IP_FILE_NAME =
|
||||
newProperty(STRING, "Converter.Rakamak.ipFileName", "UsersIp.rak");
|
||||
newProperty("Converter.Rakamak.ipFileName", "UsersIp.rak");
|
||||
|
||||
@Comment("CrazyLogin database file name")
|
||||
public static final Property<String> CRAZYLOGIN_FILE_NAME =
|
||||
newProperty(STRING, "Converter.CrazyLogin.fileName", "accounts.db");
|
||||
newProperty("Converter.CrazyLogin.fileName", "accounts.db");
|
||||
|
||||
private ConverterSettings() {
|
||||
}
|
||||
|
||||
@@ -6,29 +6,26 @@ import fr.xephi.authme.settings.domain.SettingsClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static fr.xephi.authme.settings.domain.Property.newListProperty;
|
||||
import static fr.xephi.authme.settings.domain.Property.newProperty;
|
||||
import static fr.xephi.authme.settings.domain.PropertyType.BOOLEAN;
|
||||
import static fr.xephi.authme.settings.domain.PropertyType.INTEGER;
|
||||
import static fr.xephi.authme.settings.domain.PropertyType.STRING;
|
||||
import static fr.xephi.authme.settings.domain.PropertyType.STRING_LIST;
|
||||
|
||||
public class EmailSettings implements SettingsClass {
|
||||
|
||||
@Comment("Email SMTP server host")
|
||||
public static final Property<String> SMTP_HOST =
|
||||
newProperty(STRING, "Email.mailSMTP", "smtp.gmail.com");
|
||||
newProperty("Email.mailSMTP", "smtp.gmail.com");
|
||||
|
||||
@Comment("Email SMTP server port")
|
||||
public static final Property<Integer> SMTP_PORT =
|
||||
newProperty(INTEGER, "Email.mailPort", 465);
|
||||
newProperty("Email.mailPort", 465);
|
||||
|
||||
@Comment("Email account which sends the mails")
|
||||
public static final Property<String> MAIL_ACCOUNT =
|
||||
newProperty(STRING, "Email.mailAccount", "");
|
||||
newProperty("Email.mailAccount", "");
|
||||
|
||||
@Comment("Email account password")
|
||||
public static final Property<String> MAIL_PASSWORD =
|
||||
newProperty(STRING, "Email.mailPassword", "");
|
||||
newProperty("Email.mailPassword", "");
|
||||
|
||||
@Comment("Custom sender name, replacing the mailAccount name in the email")
|
||||
public static final Property<String> MAIL_SENDER_NAME =
|
||||
@@ -36,39 +33,39 @@ public class EmailSettings implements SettingsClass {
|
||||
|
||||
@Comment("Recovery password length")
|
||||
public static final Property<Integer> RECOVERY_PASSWORD_LENGTH =
|
||||
newProperty(INTEGER, "Email.RecoveryPasswordLength", 8);
|
||||
newProperty("Email.RecoveryPasswordLength", 8);
|
||||
|
||||
@Comment("Mail Subject")
|
||||
public static final Property<String> RECOVERY_MAIL_SUBJECT =
|
||||
newProperty(STRING, "Email.mailSubject", "Your new AuthMe password");
|
||||
newProperty("Email.mailSubject", "Your new AuthMe password");
|
||||
|
||||
@Comment("Like maxRegPerIP but with email")
|
||||
public static final Property<Integer> MAX_REG_PER_EMAIL =
|
||||
newProperty(INTEGER, "Email.maxRegPerEmail", 1);
|
||||
newProperty("Email.maxRegPerEmail", 1);
|
||||
|
||||
@Comment("Recall players to add an email?")
|
||||
public static final Property<Boolean> RECALL_PLAYERS =
|
||||
newProperty(BOOLEAN, "Email.recallPlayers", false);
|
||||
newProperty("Email.recallPlayers", false);
|
||||
|
||||
@Comment("Delay in minute for the recall scheduler")
|
||||
public static final Property<Integer> DELAY_RECALL =
|
||||
newProperty(INTEGER, "Email.delayRecall", 5);
|
||||
newProperty("Email.delayRecall", 5);
|
||||
|
||||
@Comment("Blacklist these domains for emails")
|
||||
public static final Property<List<String>> DOMAIN_BLACKLIST =
|
||||
newProperty(STRING_LIST, "Email.emailBlacklisted", "10minutemail.com");
|
||||
newListProperty("Email.emailBlacklisted", "10minutemail.com");
|
||||
|
||||
@Comment("Whitelist ONLY these domains for emails")
|
||||
public static final Property<List<String>> DOMAIN_WHITELIST =
|
||||
newProperty(STRING_LIST, "Email.emailWhitelisted");
|
||||
newListProperty("Email.emailWhitelisted");
|
||||
|
||||
@Comment("Send the new password drawn in an image?")
|
||||
public static final Property<Boolean> PASSWORD_AS_IMAGE =
|
||||
newProperty(BOOLEAN, "Email.generateImage", false);
|
||||
newProperty("Email.generateImage", false);
|
||||
|
||||
@Comment("The OAuth2 token")
|
||||
public static final Property<String> OAUTH2_TOKEN =
|
||||
newProperty(STRING, "Email.emailOauth2Token", "");
|
||||
newProperty("Email.emailOauth2Token", "");
|
||||
|
||||
private EmailSettings() {
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
import fr.xephi.authme.settings.domain.PropertyType;
|
||||
import fr.xephi.authme.settings.domain.SettingsClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static fr.xephi.authme.settings.domain.Property.newListProperty;
|
||||
import static fr.xephi.authme.settings.domain.Property.newProperty;
|
||||
|
||||
public class HooksSettings implements SettingsClass {
|
||||
@@ -48,7 +48,7 @@ public class HooksSettings implements SettingsClass {
|
||||
|
||||
@Comment("Other MySQL columns where we need to put the username (case-sensitive)")
|
||||
public static final Property<List<String>> MYSQL_OTHER_USERNAME_COLS =
|
||||
newProperty(PropertyType.STRING_LIST, "ExternalBoardOptions.mySQLOtherUsernameColumns");
|
||||
newListProperty("ExternalBoardOptions.mySQLOtherUsernameColumns");
|
||||
|
||||
@Comment("How much log2 rounds needed in BCrypt (do not change if you do not know what it does)")
|
||||
public static final Property<Integer> BCRYPT_LOG2_ROUND =
|
||||
|
||||
@@ -6,39 +6,37 @@ import fr.xephi.authme.settings.domain.SettingsClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static fr.xephi.authme.settings.domain.Property.newListProperty;
|
||||
import static fr.xephi.authme.settings.domain.Property.newProperty;
|
||||
import static fr.xephi.authme.settings.domain.PropertyType.BOOLEAN;
|
||||
import static fr.xephi.authme.settings.domain.PropertyType.INTEGER;
|
||||
import static fr.xephi.authme.settings.domain.PropertyType.STRING_LIST;
|
||||
|
||||
|
||||
public class ProtectionSettings implements SettingsClass {
|
||||
|
||||
@Comment("Enable some servers protection (country based login, antibot)")
|
||||
public static final Property<Boolean> ENABLE_PROTECTION =
|
||||
newProperty(BOOLEAN, "Protection.enableProtection", false);
|
||||
newProperty("Protection.enableProtection", false);
|
||||
|
||||
@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<List<String>> COUNTRIES_WHITELIST =
|
||||
newProperty(STRING_LIST, "Protection.countries", "US", "GB", "A1");
|
||||
newListProperty("Protection.countries", "US", "GB", "A1");
|
||||
|
||||
@Comment({"Countries not allowed to join the server and register",
|
||||
"PLEASE USE QUOTES!"})
|
||||
public static final Property<List<String>> COUNTRIES_BLACKLIST =
|
||||
newProperty(STRING_LIST, "Protection.countriesBlacklist");
|
||||
newListProperty("Protection.countriesBlacklist");
|
||||
|
||||
@Comment("Do we need to enable automatic antibot system?")
|
||||
public static final Property<Boolean> ENABLE_ANTIBOT =
|
||||
newProperty(BOOLEAN, "Protection.enableAntiBot", false);
|
||||
newProperty("Protection.enableAntiBot", false);
|
||||
|
||||
@Comment("Max number of player allowed to login in 5 secs before enable AntiBot system automatically")
|
||||
public static final Property<Integer> ANTIBOT_SENSIBILITY =
|
||||
newProperty(INTEGER, "Protection.antiBotSensibility", 5);
|
||||
newProperty("Protection.antiBotSensibility", 5);
|
||||
|
||||
@Comment("Duration in minutes of the antibot automatic system")
|
||||
public static final Property<Integer> ANTIBOT_DURATION =
|
||||
newProperty(INTEGER, "Protection.antiBotDuration", 10);
|
||||
newProperty("Protection.antiBotDuration", 10);
|
||||
|
||||
private ProtectionSettings() {
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
import fr.xephi.authme.settings.domain.PropertyType;
|
||||
import fr.xephi.authme.settings.domain.SettingsClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static fr.xephi.authme.settings.domain.Property.newListProperty;
|
||||
import static fr.xephi.authme.settings.domain.Property.newProperty;
|
||||
|
||||
public class RegistrationSettings implements SettingsClass {
|
||||
@@ -50,21 +50,21 @@ public class RegistrationSettings implements SettingsClass {
|
||||
|
||||
@Comment("Force these commands after /login, without any '/', use %p to replace with player name")
|
||||
public static final Property<List<String>> FORCE_COMMANDS =
|
||||
newProperty(PropertyType.STRING_LIST, "settings.forceCommands");
|
||||
newListProperty("settings.forceCommands");
|
||||
|
||||
@Comment("Force these commands after /login as service console, without any '/'. "
|
||||
+ "Use %p to replace with player name")
|
||||
public static final Property<List<String>> FORCE_COMMANDS_AS_CONSOLE =
|
||||
newProperty(PropertyType.STRING_LIST, "settings.forceCommandsAsConsole");
|
||||
newListProperty("settings.forceCommandsAsConsole");
|
||||
|
||||
@Comment("Force these commands after /register, without any '/', use %p to replace with player name")
|
||||
public static final Property<List<String>> FORCE_REGISTER_COMMANDS =
|
||||
newProperty(PropertyType.STRING_LIST, "settings.forceRegisterCommands");
|
||||
newListProperty("settings.forceRegisterCommands");
|
||||
|
||||
@Comment("Force these commands after /register as a server console, without any '/'. "
|
||||
+ "Use %p to replace with player name")
|
||||
public static final Property<List<String>> FORCE_REGISTER_COMMANDS_AS_CONSOLE =
|
||||
newProperty(PropertyType.STRING_LIST, "settings.forceRegisterCommandsAsConsole");
|
||||
newListProperty("settings.forceRegisterCommandsAsConsole");
|
||||
|
||||
@Comment({
|
||||
"Enable to display the welcome message (welcome.txt) after a registration or a login",
|
||||
|
||||
@@ -2,11 +2,11 @@ package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
import fr.xephi.authme.settings.domain.PropertyType;
|
||||
import fr.xephi.authme.settings.domain.SettingsClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static fr.xephi.authme.settings.domain.Property.newListProperty;
|
||||
import static fr.xephi.authme.settings.domain.Property.newProperty;
|
||||
|
||||
public class RestrictionSettings implements SettingsClass {
|
||||
@@ -26,7 +26,7 @@ public class RestrictionSettings implements SettingsClass {
|
||||
|
||||
@Comment("Allowed commands for unauthenticated players")
|
||||
public static final Property<List<String>> ALLOW_COMMANDS =
|
||||
newProperty(PropertyType.STRING_LIST, "settings.restrictions.allowCommands",
|
||||
newListProperty("settings.restrictions.allowCommands",
|
||||
"login", "register", "l", "reg", "email", "captcha");
|
||||
|
||||
@Comment("Max number of allowed registrations per IP")
|
||||
@@ -75,7 +75,7 @@ public class RestrictionSettings implements SettingsClass {
|
||||
" AllowedRestrictedUser:",
|
||||
" - playername;127.0.0.1"})
|
||||
public static final Property<List<String>> ALLOWED_RESTRICTED_USERS =
|
||||
newProperty(PropertyType.STRING_LIST, "settings.restrictions.AllowedRestrictedUser");
|
||||
newListProperty("settings.restrictions.AllowedRestrictedUser");
|
||||
|
||||
@Comment("Should unregistered players be kicked immediately?")
|
||||
public static final Property<Boolean> KICK_NON_REGISTERED =
|
||||
@@ -148,7 +148,7 @@ public class RestrictionSettings implements SettingsClass {
|
||||
"WorldNames where we need to force the spawn location for ForceSpawnLocOnJoinEnabled",
|
||||
"Case-sensitive!"})
|
||||
public static final Property<List<String>> FORCE_SPAWN_ON_WORLDS =
|
||||
newProperty(PropertyType.STRING_LIST, "settings.restrictions.ForceSpawnOnTheseWorlds",
|
||||
newListProperty("settings.restrictions.ForceSpawnOnTheseWorlds",
|
||||
"world", "world_nether", "world_the_end");
|
||||
|
||||
@Comment("Ban ip when the ip is not the ip registered in database")
|
||||
@@ -189,7 +189,7 @@ public class RestrictionSettings implements SettingsClass {
|
||||
"It is case-sensitive!"
|
||||
})
|
||||
public static final Property<List<String>> UNRESTRICTED_NAMES =
|
||||
newProperty(PropertyType.STRING_LIST, "settings.unrestrictions.UnrestrictedName");
|
||||
newListProperty("settings.unrestrictions.UnrestrictedName");
|
||||
|
||||
|
||||
private RestrictionSettings() {
|
||||
|
||||
@@ -7,8 +7,8 @@ import fr.xephi.authme.settings.domain.SettingsClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static fr.xephi.authme.settings.domain.Property.newListProperty;
|
||||
import static fr.xephi.authme.settings.domain.Property.newProperty;
|
||||
import static fr.xephi.authme.settings.domain.PropertyType.STRING_LIST;
|
||||
|
||||
public class SecuritySettings implements SettingsClass {
|
||||
|
||||
@@ -98,8 +98,7 @@ public class SecuritySettings implements SettingsClass {
|
||||
"- '123456'",
|
||||
"- 'password'"})
|
||||
public static final Property<List<String>> UNSAFE_PASSWORDS =
|
||||
newProperty(STRING_LIST, "settings.security.unsafePasswords",
|
||||
"123456", "password", "qwerty", "12345", "54321");
|
||||
newListProperty("settings.security.unsafePasswords", "123456", "password", "qwerty", "12345", "54321");
|
||||
|
||||
private SecuritySettings() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user