Sync repo files to b22

This commit is contained in:
HaHaWTH
2023-09-20 02:15:22 +08:00
parent ed320196fe
commit 3f6a7ce48f
478 changed files with 94676 additions and 0 deletions
@@ -0,0 +1,28 @@
package fr.xephi.authme.settings.properties;
import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.configurationdata.ConfigurationData;
import ch.jalu.configme.configurationdata.ConfigurationDataBuilder;
import ch.jalu.configme.properties.Property;
/**
* Utility class responsible for retrieving all {@link Property} fields from {@link SettingsHolder} classes.
*/
public final class AuthMeSettingsRetriever {
private AuthMeSettingsRetriever() {
}
/**
* Builds the configuration data for all property fields in AuthMe {@link SettingsHolder} classes.
*
* @return configuration data
*/
public static ConfigurationData buildConfigurationData() {
return ConfigurationDataBuilder.createConfiguration(
DatabaseSettings.class, PluginSettings.class, RestrictionSettings.class,
EmailSettings.class, HooksSettings.class, ProtectionSettings.class,
PurgeSettings.class, SecuritySettings.class, RegistrationSettings.class,
LimboSettings.class, BackupSettings.class, ConverterSettings.class);
}
}
@@ -0,0 +1,29 @@
package fr.xephi.authme.settings.properties;
import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.properties.Property;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class BackupSettings implements SettingsHolder {
@Comment("General configuration for backups: if false, no backups are possible")
public static final Property<Boolean> ENABLED =
newProperty("BackupSystem.ActivateBackup", false);
@Comment("Create backup at every start of server")
public static final Property<Boolean> ON_SERVER_START =
newProperty("BackupSystem.OnServerStart", false);
@Comment("Create backup at every stop of server")
public static final Property<Boolean> ON_SERVER_STOP =
newProperty("BackupSystem.OnServerStop", true);
@Comment("Windows only: MySQL installation path")
public static final Property<String> MYSQL_WINDOWS_PATH =
newProperty("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\");
private BackupSettings() {
}
}
@@ -0,0 +1,56 @@
package fr.xephi.authme.settings.properties;
import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.configurationdata.CommentsConfiguration;
import ch.jalu.configme.properties.Property;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class ConverterSettings implements SettingsHolder {
@Comment("Rakamak file name")
public static final Property<String> RAKAMAK_FILE_NAME =
newProperty("Converter.Rakamak.fileName", "users.rak");
@Comment("Rakamak use IP?")
public static final Property<Boolean> RAKAMAK_USE_IP =
newProperty("Converter.Rakamak.useIP", false);
@Comment("Rakamak IP file name")
public static final Property<String> RAKAMAK_IP_FILE_NAME =
newProperty("Converter.Rakamak.ipFileName", "UsersIp.rak");
@Comment("CrazyLogin database file name")
public static final Property<String> CRAZYLOGIN_FILE_NAME =
newProperty("Converter.CrazyLogin.fileName", "accounts.db");
@Comment("LoginSecurity: convert from SQLite; if false we use MySQL")
public static final Property<Boolean> LOGINSECURITY_USE_SQLITE =
newProperty("Converter.loginSecurity.useSqlite", true);
@Comment("LoginSecurity MySQL: database host")
public static final Property<String> LOGINSECURITY_MYSQL_HOST =
newProperty("Converter.loginSecurity.mySql.host", "");
@Comment("LoginSecurity MySQL: database name")
public static final Property<String> LOGINSECURITY_MYSQL_DATABASE =
newProperty("Converter.loginSecurity.mySql.database", "");
@Comment("LoginSecurity MySQL: database user")
public static final Property<String> LOGINSECURITY_MYSQL_USER =
newProperty("Converter.loginSecurity.mySql.user", "");
@Comment("LoginSecurity MySQL: password for database user")
public static final Property<String> LOGINSECURITY_MYSQL_PASSWORD =
newProperty("Converter.loginSecurity.mySql.password", "");
private ConverterSettings() {
}
@Override
public void registerComments(CommentsConfiguration conf) {
conf.setComment("Converter",
"Converter settings: see https://github.com/AuthMe/AuthMeReloaded/wiki/Converters");
}
}
@@ -0,0 +1,157 @@
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.datasource.DataSourceType;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class DatabaseSettings implements SettingsHolder {
@Comment({"What type of database do you want to use?",
"Valid values: SQLITE, MARIADB, MYSQL, POSTGRESQL"})
public static final Property<DataSourceType> BACKEND =
newProperty(DataSourceType.class, "DataSource.backend", DataSourceType.SQLITE);
@Comment({"Enable the database caching system, should be disabled on bungeecord environments",
"or when a website integration is being used."})
public static final Property<Boolean> USE_CACHING =
newProperty("DataSource.caching", true);
@Comment("Database host address")
public static final Property<String> MYSQL_HOST =
newProperty("DataSource.mySQLHost", "127.0.0.1");
@Comment("Database port")
public static final Property<String> MYSQL_PORT =
newProperty("DataSource.mySQLPort", "3306");
@Comment("Connect to MySQL database over SSL")
public static final Property<Boolean> MYSQL_USE_SSL =
newProperty("DataSource.mySQLUseSSL", true);
@Comment({"Verification of server's certificate.",
"We would not recommend to set this option to false.",
"Set this option to false at your own risk if and only if you know what you're doing"})
public static final Property<Boolean> MYSQL_CHECK_SERVER_CERTIFICATE =
newProperty( "DataSource.mySQLCheckServerCertificate", true );
@Comment({"Authorize client to retrieve RSA server public key.",
"Advanced option, ignore if you don't know what it means."})
public static final Property<Boolean> MYSQL_ALLOW_PUBLIC_KEY_RETRIEVAL =
newProperty( "DataSource.mySQLAllowPublicKeyRetrieval", true );
@Comment("Username to connect to the MySQL database")
public static final Property<String> MYSQL_USERNAME =
newProperty("DataSource.mySQLUsername", "authme");
@Comment("Password to connect to the MySQL database")
public static final Property<String> MYSQL_PASSWORD =
newProperty("DataSource.mySQLPassword", "12345");
@Comment("Database Name, use with converters or as SQLITE database name")
public static final Property<String> MYSQL_DATABASE =
newProperty("DataSource.mySQLDatabase", "authme");
@Comment("Table of the database")
public static final Property<String> MYSQL_TABLE =
newProperty("DataSource.mySQLTablename", "authme");
@Comment("Column of IDs to sort data")
public static final Property<String> MYSQL_COL_ID =
newProperty("DataSource.mySQLColumnId", "id");
@Comment("Column for storing or checking players nickname")
public static final Property<String> MYSQL_COL_NAME =
newProperty("DataSource.mySQLColumnName", "username");
@Comment("Column for storing or checking players RealName")
public static final Property<String> MYSQL_COL_REALNAME =
newProperty("DataSource.mySQLRealName", "realname");
@Comment("Column for storing players passwords")
public static final Property<String> MYSQL_COL_PASSWORD =
newProperty("DataSource.mySQLColumnPassword", "password");
@Comment("Column for storing players passwords salts")
public static final Property<String> MYSQL_COL_SALT =
newProperty("DataSource.mySQLColumnSalt", "");
@Comment("Column for storing players emails")
public static final Property<String> MYSQL_COL_EMAIL =
newProperty("DataSource.mySQLColumnEmail", "email");
@Comment("Column for storing if a player is logged in or not")
public static final Property<String> MYSQL_COL_ISLOGGED =
newProperty("DataSource.mySQLColumnLogged", "isLogged");
@Comment("Column for storing if a player has a valid session or not")
public static final Property<String> MYSQL_COL_HASSESSION =
newProperty("DataSource.mySQLColumnHasSession", "hasSession");
@Comment("Column for storing a player's TOTP key (for two-factor authentication)")
public static final Property<String> MYSQL_COL_TOTP_KEY =
newProperty("DataSource.mySQLtotpKey", "totp");
@Comment("Column for storing the player's last IP")
public static final Property<String> MYSQL_COL_LAST_IP =
newProperty("DataSource.mySQLColumnIp", "ip");
@Comment("Column for storing players lastlogins")
public static final Property<String> MYSQL_COL_LASTLOGIN =
newProperty("DataSource.mySQLColumnLastLogin", "lastlogin");
@Comment("Column storing the registration date")
public static final Property<String> MYSQL_COL_REGISTER_DATE =
newProperty("DataSource.mySQLColumnRegisterDate", "regdate");
@Comment("Column for storing the IP address at the time of registration")
public static final Property<String> MYSQL_COL_REGISTER_IP =
newProperty("DataSource.mySQLColumnRegisterIp", "regip");
@Comment("Column for storing player LastLocation - X")
public static final Property<String> MYSQL_COL_LASTLOC_X =
newProperty("DataSource.mySQLlastlocX", "x");
@Comment("Column for storing player LastLocation - Y")
public static final Property<String> MYSQL_COL_LASTLOC_Y =
newProperty("DataSource.mySQLlastlocY", "y");
@Comment("Column for storing player LastLocation - Z")
public static final Property<String> MYSQL_COL_LASTLOC_Z =
newProperty("DataSource.mySQLlastlocZ", "z");
@Comment("Column for storing player LastLocation - World Name")
public static final Property<String> MYSQL_COL_LASTLOC_WORLD =
newProperty("DataSource.mySQLlastlocWorld", "world");
@Comment("Column for storing player LastLocation - Yaw")
public static final Property<String> MYSQL_COL_LASTLOC_YAW =
newProperty("DataSource.mySQLlastlocYaw", "yaw");
@Comment("Column for storing player LastLocation - Pitch")
public static final Property<String> MYSQL_COL_LASTLOC_PITCH =
newProperty("DataSource.mySQLlastlocPitch", "pitch");
@Comment("Column for storing players uuids (optional)")
public static final Property<String> MYSQL_COL_PLAYER_UUID =
newProperty( "DataSource.mySQLPlayerUUID", "" );
@Comment("Column for storing players groups")
public static final Property<String> MYSQL_COL_GROUP =
newProperty("ExternalBoardOptions.mySQLColumnGroup", "");
@Comment("Overrides the size of the DB Connection Pool, default = 10")
public static final Property<Integer> MYSQL_POOL_SIZE =
newProperty("DataSource.poolSize", 10);
@Comment({"The maximum lifetime of a connection in the pool, default = 1800 seconds",
"You should set this at least 30 seconds less than mysql server wait_timeout"})
public static final Property<Integer> MYSQL_CONNECTION_MAX_LIFETIME =
newProperty("DataSource.maxLifetime", 1800);
private DatabaseSettings() {
}
}
@@ -0,0 +1,76 @@
package fr.xephi.authme.settings.properties;
import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.properties.Property;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class EmailSettings implements SettingsHolder {
@Comment("Email SMTP server host")
public static final Property<String> SMTP_HOST =
newProperty("Email.mailSMTP", "smtp.163.com");
@Comment("Email SMTP server port")
public static final Property<Integer> SMTP_PORT =
newProperty("Email.mailPort", 465);
@Comment("Only affects port 25: enable TLS/STARTTLS?")
public static final Property<Boolean> PORT25_USE_TLS =
newProperty("Email.useTls", true);
@Comment("Email account which sends the mails")
public static final Property<String> MAIL_ACCOUNT =
newProperty("Email.mailAccount", "");
@Comment("Email account password")
public static final Property<String> MAIL_PASSWORD =
newProperty("Email.mailPassword", "");
@Comment("Email address, fill when mailAccount is not the email address of the account")
public static final Property<String> MAIL_ADDRESS =
newProperty("Email.mailAddress", "");
@Comment("Custom sender name, replacing the mailAccount name in the email")
public static final Property<String> MAIL_SENDER_NAME =
newProperty("Email.mailSenderName", "");
@Comment("Recovery password length")
public static final Property<Integer> RECOVERY_PASSWORD_LENGTH =
newProperty("Email.RecoveryPasswordLength", 12);
@Comment("Mail Subject")
public static final Property<String> RECOVERY_MAIL_SUBJECT =
newProperty("Email.mailSubject", "Your new AuthMe password");
@Comment("Like maxRegPerIP but with email")
public static final Property<Integer> MAX_REG_PER_EMAIL =
newProperty("Email.maxRegPerEmail", 1);
@Comment("Recall players to add an email?")
public static final Property<Boolean> RECALL_PLAYERS =
newProperty("Email.recallPlayers", false);
@Comment("Delay in minute for the recall scheduler")
public static final Property<Integer> DELAY_RECALL =
newProperty("Email.delayRecall", 5);
@Comment("Send the new password drawn in an image?")
public static final Property<Boolean> PASSWORD_AS_IMAGE =
newProperty("Email.generateImage", false);
@Comment("The OAuth2 token")
public static final Property<String> OAUTH2_TOKEN =
newProperty("Email.emailOauth2Token", "");
@Comment("Email notifications when the server shuts down")
public static final Property<Boolean> SHUTDOWN_MAIL =
newProperty("Email.shutDownEmail", false);
@Comment("Email notification address when the server is shut down")
public static final Property<String> SHUTDOWN_MAIL_ADDRESS =
newProperty("Email.shutDownEmailAddress", "your@mail.com");
private EmailSettings() {
}
}
@@ -0,0 +1,86 @@
package fr.xephi.authme.settings.properties;
import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.properties.Property;
import java.util.List;
import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class HooksSettings implements SettingsHolder {
@Comment("Do we need to hook with multiverse for spawn checking?")
public static final Property<Boolean> MULTIVERSE =
newProperty("Hooks.multiverse", true);
@Comment("Do we need to hook with BungeeCord?")
public static final Property<Boolean> BUNGEECORD =
newProperty("Hooks.bungeecord", false);
@Comment("Allow FloodGatePlayer Join Without checkIsValidName()")
public static final Property<Boolean> HOOK_FLOODGATE_PLAYER =
newProperty("Hooks.floodgate", false);
@Comment("Send player to this BungeeCord server after register/login")
public static final Property<String> BUNGEECORD_SERVER =
newProperty("Hooks.sendPlayerTo", "");
@Comment("Do we need to disable Essentials SocialSpy on join?")
public static final Property<Boolean> DISABLE_SOCIAL_SPY =
newProperty("Hooks.disableSocialSpy", false);
@Comment("Do we need to force /motd Essentials command on join?")
public static final Property<Boolean> USE_ESSENTIALS_MOTD =
newProperty("Hooks.useEssentialsMotd", false);
@Comment({
"-1 means disabled. If you want that only activated players",
"can log into your server, you can set here the group number",
"of unactivated users, needed for some forum/CMS support"})
public static final Property<Integer> NON_ACTIVATED_USERS_GROUP =
newProperty("ExternalBoardOptions.nonActivedUserGroup", -1);
@Comment("Other MySQL columns where we need to put the username (case-sensitive)")
public static final Property<List<String>> MYSQL_OTHER_USERNAME_COLS =
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 =
newProperty("ExternalBoardOptions.bCryptLog2Round", 12);
@Comment("phpBB table prefix defined during the phpBB installation process")
public static final Property<String> PHPBB_TABLE_PREFIX =
newProperty("ExternalBoardOptions.phpbbTablePrefix", "phpbb_");
@Comment("phpBB activated group ID; 2 is the default registered group defined by phpBB")
public static final Property<Integer> PHPBB_ACTIVATED_GROUP_ID =
newProperty("ExternalBoardOptions.phpbbActivatedGroupId", 2);
@Comment("IP Board table prefix defined during the IP Board installation process")
public static final Property<String> IPB_TABLE_PREFIX =
newProperty("ExternalBoardOptions.IPBTablePrefix", "ipb_");
@Comment("IP Board default group ID; 3 is the default registered group defined by IP Board")
public static final Property<Integer> IPB_ACTIVATED_GROUP_ID =
newProperty("ExternalBoardOptions.IPBActivatedGroupId", 3);
@Comment("Xenforo table prefix defined during the Xenforo installation process")
public static final Property<String> XF_TABLE_PREFIX =
newProperty("ExternalBoardOptions.XFTablePrefix", "xf_");
@Comment("XenForo default group ID; 2 is the default registered group defined by Xenforo")
public static final Property<Integer> XF_ACTIVATED_GROUP_ID =
newProperty("ExternalBoardOptions.XFActivatedGroupId", 2);
@Comment("Wordpress prefix defined during WordPress installation")
public static final Property<String> WORDPRESS_TABLE_PREFIX =
newProperty("ExternalBoardOptions.wordpressTablePrefix", "wp_");
private HooksSettings() {
}
}
@@ -0,0 +1,83 @@
package fr.xephi.authme.settings.properties;
import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.configurationdata.CommentsConfiguration;
import ch.jalu.configme.properties.Property;
import fr.xephi.authme.data.limbo.AllowFlightRestoreType;
import fr.xephi.authme.data.limbo.WalkFlySpeedRestoreType;
import fr.xephi.authme.data.limbo.persistence.LimboPersistenceType;
import fr.xephi.authme.data.limbo.persistence.SegmentSize;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
/**
* Settings for the LimboPlayer feature.
*/
public final class LimboSettings implements SettingsHolder {
@Comment({
"Besides storing the data in memory, you can define if/how the data should be persisted",
"on disk. This is useful in case of a server crash, so next time the server starts we can",
"properly restore things like OP status, ability to fly, and walk/fly speed.",
"DISABLED: no disk storage,",
"INDIVIDUAL_FILES: each player data in its own file,",
"DISTRIBUTED_FILES: distributes players into different files based on their UUID, see below"
})
public static final Property<LimboPersistenceType> LIMBO_PERSISTENCE_TYPE =
newProperty(LimboPersistenceType.class, "limbo.persistence.type", LimboPersistenceType.INDIVIDUAL_FILES);
@Comment({
"This setting only affects DISTRIBUTED_FILES persistence. The distributed file",
"persistence attempts to reduce the number of files by distributing players into various",
"buckets based on their UUID. This setting defines into how many files the players should",
"be distributed. Possible values: ONE, FOUR, EIGHT, SIXTEEN, THIRTY_TWO, SIXTY_FOUR,",
"ONE_TWENTY for 128, TWO_FIFTY for 256.",
"For example, if you expect 100 non-logged in players, setting to SIXTEEN will average",
"6.25 players per file (100 / 16).",
"Note: if you change this setting all data will be migrated. If you have a lot of data,",
"change this setting only on server restart, not with /authme reload."
})
public static final Property<SegmentSize> DISTRIBUTION_SIZE =
newProperty(SegmentSize.class, "limbo.persistence.distributionSize", SegmentSize.SIXTEEN);
@Comment({
"Whether the player is allowed to fly: RESTORE, ENABLE, DISABLE, NOTHING.",
"RESTORE sets back the old property from the player. NOTHING will prevent AuthMe",
"from modifying the 'allow flight' property on the player."
})
public static final Property<AllowFlightRestoreType> RESTORE_ALLOW_FLIGHT =
newProperty(AllowFlightRestoreType.class, "limbo.restoreAllowFlight", AllowFlightRestoreType.RESTORE);
@Comment({
"Restore fly speed: RESTORE, DEFAULT, MAX_RESTORE, RESTORE_NO_ZERO.",
"RESTORE: restore the speed the player had;",
"DEFAULT: always set to default speed;",
"MAX_RESTORE: take the maximum of the player's current speed and the previous one",
"RESTORE_NO_ZERO: Like 'restore' but sets speed to default if the player's speed was 0"
})
public static final Property<WalkFlySpeedRestoreType> RESTORE_FLY_SPEED =
newProperty(WalkFlySpeedRestoreType.class, "limbo.restoreFlySpeed", WalkFlySpeedRestoreType.RESTORE_NO_ZERO);
@Comment({
"Restore walk speed: RESTORE, DEFAULT, MAX_RESTORE, RESTORE_NO_ZERO.",
"See above for a description of the values."
})
public static final Property<WalkFlySpeedRestoreType> RESTORE_WALK_SPEED =
newProperty(WalkFlySpeedRestoreType.class, "limbo.restoreWalkSpeed", WalkFlySpeedRestoreType.RESTORE_NO_ZERO);
private LimboSettings() {
}
@Override
public void registerComments(CommentsConfiguration conf) {
String[] limboExplanation = {
"Before a user logs in, various properties are temporarily removed from the player,",
"such as OP status, ability to fly, and walk/fly speed.",
"Once the user is logged in, we add back the properties we previously saved.",
"In this section, you may define how these properties should be handled.",
"Read more at https://github.com/AuthMe/AuthMeReloaded/wiki/Limbo-players"
};
conf.setComment("limbo", limboExplanation);
}
}
@@ -0,0 +1,91 @@
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.output.LogLevel;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class PluginSettings implements SettingsHolder {
@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<Boolean> 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<Integer> SESSIONS_TIMEOUT =
newProperty("settings.sessions.timeout", 43200);
@Comment({
"Message language, available languages:",
"https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/translations.md"
})
public static final Property<String> MESSAGES_LANGUAGE =
newProperty("settings.messagesLanguage", "zhcn");
@Comment({
"Enables switching a player to defined permission groups before they log in.",
"See below for a detailed explanation."
})
public static final Property<Boolean> ENABLE_PERMISSION_CHECK =
newProperty("GroupOptions.enablePermissionCheck", false);
@Comment({
"This is a very important option: if a registered player joins the server",
"AuthMe will switch him to unLoggedInGroup. This should prevent all major exploits.",
"You can set up your permission plugin with this special group to have no permissions,",
"or only permission to chat (or permission to send private messages etc.).",
"The better way is to set up this group with few permissions, so if a player",
"tries to exploit an account they can do only what you've defined for the group.",
"After login, the player will be moved to his correct permissions group!",
"Please note that the group name is case-sensitive, so 'admin' is different from 'Admin'",
"Otherwise your group will be wiped and the player will join in the default group []!",
"Example: registeredPlayerGroup: 'NotLogged'"
})
public static final Property<String> REGISTERED_GROUP =
newProperty("GroupOptions.registeredPlayerGroup", "");
@Comment({
"Similar to above, unregistered players can be set to the following",
"permissions group"
})
public static final Property<String> UNREGISTERED_GROUP =
newProperty("GroupOptions.unregisteredPlayerGroup", "");
@Comment("Forces authme to hook into Vault instead of a specific permission handler system.")
public static final Property<Boolean> 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<LogLevel> 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<Boolean> USE_ASYNC_TASKS =
newProperty("settings.useAsyncTasks", true);
@Comment("The name of the server, used in some placeholders.")
public static final Property<String> SERVER_NAME = newProperty("settings.serverName", "Your Minecraft Server");
private PluginSettings() {
}
}
@@ -0,0 +1,66 @@
package fr.xephi.authme.settings.properties;
import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.properties.Property;
import java.util.List;
import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class ProtectionSettings implements SettingsHolder {
@Comment("Enable some servers protection (country based login, antibot)")
public static final Property<Boolean> ENABLE_PROTECTION =
newProperty("Protection.enableProtection", true);
@Comment("Apply the protection also to registered usernames")
public static final Property<Boolean> ENABLE_PROTECTION_REGISTERED =
newProperty("Protection.enableProtectionRegistered", true);
@Comment({
"Countries allowed to join the server and register. For country codes, see",
"https://dev.maxmind.com/geoip/legacy/codes/iso3166/",
"Use \"LOCALHOST\" for local addresses.",
"PLEASE USE QUOTES!"})
public static final Property<List<String>> COUNTRIES_WHITELIST =
newListProperty("Protection.countries", "CN", "LOCALHOST");
@Comment({
"Countries not allowed to join the server and register",
"PLEASE USE QUOTES!"})
public static final Property<List<String>> COUNTRIES_BLACKLIST =
newListProperty("Protection.countriesBlacklist", "A1");
@Comment("Do we need to enable automatic antibot system?")
public static final Property<Boolean> ENABLE_ANTIBOT =
newProperty("Protection.enableAntiBot", true);
@Comment("The interval in seconds")
public static final Property<Integer> ANTIBOT_INTERVAL =
newProperty("Protection.antiBotInterval", 5);
@Comment({
"Max number of players allowed to login in the interval",
"before the AntiBot system is enabled automatically"})
public static final Property<Integer> ANTIBOT_SENSIBILITY =
newProperty("Protection.antiBotSensibility", 10);
@Comment("Duration in minutes of the antibot automatic system")
public static final Property<Integer> ANTIBOT_DURATION =
newProperty("Protection.antiBotDuration", 10);
@Comment("Delay in seconds before the antibot activation")
public static final Property<Integer> ANTIBOT_DELAY =
newProperty("Protection.antiBotDelay", 60);
@Comment("Kicks the player that issued a command before the defined time after the join process")
public static final Property<Integer> QUICK_COMMANDS_DENIED_BEFORE_MILLISECONDS =
newProperty("Protection.quickCommands.denyCommandsBeforeMilliseconds", 3000);
private ProtectionSettings() {
}
}
@@ -0,0 +1,46 @@
package fr.xephi.authme.settings.properties;
import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.properties.Property;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class PurgeSettings implements SettingsHolder {
@Comment("If enabled, AuthMe automatically purges old, unused accounts")
public static final Property<Boolean> USE_AUTO_PURGE =
newProperty("Purge.useAutoPurge", false);
@Comment("Number of days after which an account should be purged")
public static final Property<Integer> DAYS_BEFORE_REMOVE_PLAYER =
newProperty("Purge.daysBeforeRemovePlayer", 60);
@Comment("Do we need to remove the player.dat file during purge process?")
public static final Property<Boolean> REMOVE_PLAYER_DAT =
newProperty("Purge.removePlayerDat", false);
@Comment("Do we need to remove the Essentials/userdata/player.yml file during purge process?")
public static final Property<Boolean> REMOVE_ESSENTIALS_FILES =
newProperty("Purge.removeEssentialsFile", false);
@Comment("World in which the players.dat are stored")
public static final Property<String> DEFAULT_WORLD =
newProperty("Purge.defaultWorld", "world");
@Comment("Remove LimitedCreative/inventories/player.yml, player_creative.yml files during purge?")
public static final Property<Boolean> REMOVE_LIMITED_CREATIVE_INVENTORIES =
newProperty("Purge.removeLimitedCreativesInventories", false);
@Comment("Do we need to remove the AntiXRayData/PlayerData/player file during purge process?")
public static final Property<Boolean> REMOVE_ANTI_XRAY_FILE =
newProperty("Purge.removeAntiXRayFile", false);
@Comment("Do we need to remove permissions?")
public static final Property<Boolean> REMOVE_PERMISSIONS =
newProperty("Purge.removePermissions", false);
private PurgeSettings() {
}
}
@@ -0,0 +1,98 @@
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.process.register.RegisterSecondaryArgument;
import fr.xephi.authme.process.register.RegistrationType;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class RegistrationSettings implements SettingsHolder {
@Comment("Enable registration on the server?")
public static final Property<Boolean> IS_ENABLED =
newProperty("settings.registration.enabled", true);
@Comment({
"Send every X seconds a message to a player to",
"remind him that he has to login/register"})
public static final Property<Integer> MESSAGE_INTERVAL =
newProperty("settings.registration.messageInterval", 5);
@Comment({
"Only registered and logged in players can play.",
"See restrictions for exceptions"})
public static final Property<Boolean> FORCE =
newProperty("settings.registration.force", true);
@Comment({
"Type of registration: PASSWORD or EMAIL",
"PASSWORD = account is registered with a password supplied by the user;",
"EMAIL = password is generated and sent to the email provided by the user.",
"More info at https://github.com/AuthMe/AuthMeReloaded/wiki/Registration"
})
public static final Property<RegistrationType> REGISTRATION_TYPE =
newProperty(RegistrationType.class, "settings.registration.type", RegistrationType.PASSWORD);
@Comment({
"Second argument the /register command should take: ",
"NONE = no 2nd argument",
"CONFIRMATION = must repeat first argument (pass or email)",
"EMAIL_OPTIONAL = for password register: 2nd argument can be empty or have email address",
"EMAIL_MANDATORY = for password register: 2nd argument MUST be an email address"
})
public static final Property<RegisterSecondaryArgument> REGISTER_SECOND_ARGUMENT =
newProperty(RegisterSecondaryArgument.class, "settings.registration.secondArg",
RegisterSecondaryArgument.CONFIRMATION);
@Comment({
"Do we force kick a player after a successful registration?",
"Do not use with login feature below"})
public static final Property<Boolean> FORCE_KICK_AFTER_REGISTER =
newProperty("settings.registration.forceKickAfterRegister", false);
@Comment("Does AuthMe need to enforce a /login after a successful registration?")
public static final Property<Boolean> FORCE_LOGIN_AFTER_REGISTER =
newProperty("settings.registration.forceLoginAfterRegister", false);
@Comment("Should we delay the join message and display it once the player has logged in?")
public static final Property<Boolean> DELAY_JOIN_MESSAGE =
newProperty("settings.delayJoinMessage", true);
@Comment({
"The custom join message that will be sent after a successful login,",
"keep empty to use the original one.",
"Available variables:",
"{PLAYERNAME}: the player name (no colors)",
"{DISPLAYNAME}: the player display name (with colors)",
"{DISPLAYNAMENOCOLOR}: the player display name (without colors)"})
public static final Property<String> CUSTOM_JOIN_MESSAGE =
newProperty("settings.customJoinMessage", "");
@Comment("Should we remove the leave messages of unlogged users?")
public static final Property<Boolean> REMOVE_UNLOGGED_LEAVE_MESSAGE =
newProperty("settings.removeUnloggedLeaveMessage", true);
@Comment("Should we remove join messages altogether?")
public static final Property<Boolean> REMOVE_JOIN_MESSAGE =
newProperty("settings.removeJoinMessage", true);
@Comment("Should we remove leave messages altogether?")
public static final Property<Boolean> REMOVE_LEAVE_MESSAGE =
newProperty("settings.removeLeaveMessage", true);
@Comment("Do we need to add potion effect Blinding before login/register?")
public static final Property<Boolean> APPLY_BLIND_EFFECT =
newProperty("settings.applyBlindEffect", false);
@Comment({
"Do we need to prevent people to login with another case?",
"If Xephi is registered, then Xephi can login, but not XEPHI/xephi/XePhI"})
public static final Property<Boolean> PREVENT_OTHER_CASE =
newProperty("settings.preventOtherCase", true);
private RegistrationSettings() {
}
}
@@ -0,0 +1,215 @@
package fr.xephi.authme.settings.properties;
import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.properties.Property;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseStringSetProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class RestrictionSettings implements SettingsHolder {
@Comment({
"Can not authenticated players chat?",
"Keep in mind that this feature also blocks all commands not",
"listed in the list below."})
public static final Property<Boolean> ALLOW_CHAT =
newProperty("settings.restrictions.allowChat", false);
@Comment("Hide the chat log from players who are not authenticated?")
public static final Property<Boolean> HIDE_CHAT =
newProperty("settings.restrictions.hideChat", false);
@Comment("Allowed commands for unauthenticated players")
public static final Property<Set<String>> ALLOW_COMMANDS =
newLowercaseStringSetProperty("settings.restrictions.allowCommands",
"/login", "/log", "/l", "/register", "/reg", "/email", "/captcha", "/2fa", "/totp");
@Comment({
"Max number of allowed registrations per IP",
"The value 0 means an unlimited number of registrations!"})
public static final Property<Integer> MAX_REGISTRATION_PER_IP =
newProperty("settings.restrictions.maxRegPerIp", 3);
@Comment("Minimum allowed username length")
public static final Property<Integer> MIN_NICKNAME_LENGTH =
newProperty("settings.restrictions.minNicknameLength", 3);
@Comment("Maximum allowed username length")
public static final Property<Integer> MAX_NICKNAME_LENGTH =
newProperty("settings.restrictions.maxNicknameLength", 16);
@Comment({
"When this setting is enabled, online players can't be kicked out",
"due to \"Logged in from another Location\"",
"This setting will prevent potential security exploits."})
public static final Property<Boolean> FORCE_SINGLE_SESSION =
newProperty("settings.restrictions.ForceSingleSession", true);
@Comment({
"If enabled, every player that spawn in one of the world listed in",
"\"ForceSpawnLocOnJoin.worlds\" will be teleported to the spawnpoint after successful",
"authentication. The quit location of the player will be overwritten.",
"This is different from \"teleportUnAuthedToSpawn\" that teleport player",
"to the spawnpoint on join."})
public static final Property<Boolean> FORCE_SPAWN_LOCATION_AFTER_LOGIN =
newProperty("settings.restrictions.ForceSpawnLocOnJoin.enabled", false);
@Comment({
"WorldNames where we need to force the spawn location",
"Case-sensitive!"})
public static final Property<List<String>> FORCE_SPAWN_ON_WORLDS =
newListProperty("settings.restrictions.ForceSpawnLocOnJoin.worlds",
"world", "world_nether", "world_the_end");
@Comment("This option will save the quit location of the players.")
public static final Property<Boolean> SAVE_QUIT_LOCATION =
newProperty("settings.restrictions.SaveQuitLocation", false);
@Comment({
"To activate the restricted user feature you need",
"to enable this option and configure the AllowedRestrictedUser field."})
public static final Property<Boolean> ENABLE_RESTRICTED_USERS =
newProperty("settings.restrictions.AllowRestrictedUser", true);
@Comment({
"The restricted user feature will kick players listed below",
"if they don't match the defined IP address. Names are case-insensitive.",
"You can use * as wildcard (127.0.0.*), or regex with a \"regex:\" prefix regex:127\\.0\\.0\\..*",
"Example:",
" AllowedRestrictedUser:",
" - playername;127.0.0.1",
" - playername;regex:127\\.0\\.0\\..*"})
public static final Property<Set<String>> RESTRICTED_USERS =
newLowercaseStringSetProperty("settings.restrictions.AllowedRestrictedUser",
"server_land;127.0.0.1","server;127.0.0.1","bukkit;127.0.0.1","purpur;127.0.0.1",
"system;127.0.0.1","admin;127.0.0.1","md_5;127.0.0.1","administrator;127.0.0.1","notch;127.0.0.1",
"spigot;127.0.0.1","bukkit;127.0.0.1","bukkitcraft;127.0.0.1","paperclip;127.0.0.1","papermc;127.0.0.1",
"spigotmc;127.0.0.1","root;127.0.0.1","console;127.0.0.1","purpur;127.0.0.1","authme;127.0.0.1",
"owner;127.0.0.1");
@Comment("Ban unknown IPs trying to log in with a restricted username?")
public static final Property<Boolean> BAN_UNKNOWN_IP =
newProperty("settings.restrictions.banUnsafedIP", false);
@Comment("Should unregistered players be kicked immediately?")
public static final Property<Boolean> KICK_NON_REGISTERED =
newProperty("settings.restrictions.kickNonRegistered", false);
@Comment("Should players be kicked on wrong password?")
public static final Property<Boolean> KICK_ON_WRONG_PASSWORD =
newProperty("settings.restrictions.kickOnWrongPassword", false);
@Comment({
"Should not logged in players be teleported to the spawn?",
"After the authentication they will be teleported back to",
"their normal position."})
public static final Property<Boolean> TELEPORT_UNAUTHED_TO_SPAWN =
newProperty("settings.restrictions.teleportUnAuthedToSpawn", false);
@Comment("Can unregistered players walk around?")
public static final Property<Boolean> ALLOW_UNAUTHED_MOVEMENT =
newProperty("settings.restrictions.allowMovement", false);
@Comment({
"After how many seconds should players who fail to login or register",
"be kicked? Set to 0 to disable."})
public static final Property<Integer> TIMEOUT =
newProperty("settings.restrictions.timeout", 120);
@Comment("Regex pattern of allowed characters in the player name.")
public static final Property<String> ALLOWED_NICKNAME_CHARACTERS =
newProperty("settings.restrictions.allowedNicknameCharacters", "[a-zA-Z0-9_]*");
@Comment({
"How far can unregistered players walk?",
"Set to 0 for unlimited radius"
})
public static final Property<Integer> ALLOWED_MOVEMENT_RADIUS =
newProperty("settings.restrictions.allowedMovementRadius", 0);
@Comment("Should we protect the player inventory before logging in? Requires ProtocolLib.")
public static final Property<Boolean> PROTECT_INVENTORY_BEFORE_LOGIN =
newProperty("settings.restrictions.ProtectInventoryBeforeLogIn", false);
@Comment("Should we deny the tabcomplete feature before logging in? Requires ProtocolLib.")
public static final Property<Boolean> DENY_TABCOMPLETE_BEFORE_LOGIN =
newProperty("settings.restrictions.DenyTabCompleteBeforeLogin", false);
@Comment({
"Should we display all other accounts from a player when he joins?",
"permission: /authme.admin.accounts"})
public static final Property<Boolean> DISPLAY_OTHER_ACCOUNTS =
newProperty("settings.restrictions.displayOtherAccounts", false);
@Comment("Spawn priority; values: authme, essentials, cmi, multiverse, default")
public static final Property<String> SPAWN_PRIORITY =
newProperty("settings.restrictions.spawnPriority", "authme,essentials,cmi,multiverse,default");
@Comment("Maximum Login authorized by IP")
public static final Property<Integer> MAX_LOGIN_PER_IP =
newProperty("settings.restrictions.maxLoginPerIp", 3);
@Comment("Maximum Join authorized by IP")
public static final Property<Integer> MAX_JOIN_PER_IP =
newProperty("settings.restrictions.maxJoinPerIp", 3);
@Comment("AuthMe will NEVER teleport players if set to true!")
public static final Property<Boolean> NO_TELEPORT =
newProperty("settings.restrictions.noTeleport", false);
@Comment({
"Regex syntax for allowed chars in passwords. The default [!-~] allows all visible ASCII",
"characters, which is what we recommend. See also http://asciitable.com",
"You can test your regex with https://regex101.com"
})
public static final Property<String> ALLOWED_PASSWORD_REGEX =
newProperty("settings.restrictions.allowedPasswordCharacters", "[!-~]*");
@Comment("Regex syntax for allowed chars in email.")
public static final Property<String> ALLOWED_EMAIL_REGEX =
newProperty("settings.restrictions.allowedEmailCharacters", "^[A-Za-z0-9_]{4,15}@(qq|outlook|163|gmail|icloud)\\.com$");
@Comment("Force survival gamemode when player joins?")
public static final Property<Boolean> FORCE_SURVIVAL_MODE =
newProperty("settings.GameMode.ForceSurvivalMode", false);
@Comment({
"Below you can list all account names that AuthMe will ignore",
"for registration or login. Configure it at your own risk!!",
"This option adds compatibility with BuildCraft and some other mods.",
"It is case-insensitive! Example:",
"UnrestrictedName:",
"- 'npcPlayer'",
"- 'npcPlayer2'"
})
public static final Property<Set<String>> UNRESTRICTED_NAMES =
newLowercaseStringSetProperty("settings.unrestrictions.UnrestrictedName");
@Comment({
"Below you can list all inventories names that AuthMe will ignore",
"for registration or login. Configure it at your own risk!!",
"This option adds compatibility with some mods.",
"It is case-insensitive! Example:",
"UnrestrictedInventories:",
"- 'myCustomInventory1'",
"- 'myCustomInventory2'"
})
public static final Property<Set<String>> UNRESTRICTED_INVENTORIES =
newLowercaseStringSetProperty("settings.unrestrictions.UnrestrictedInventories");
private RestrictionSettings() {
}
}
@@ -0,0 +1,204 @@
package fr.xephi.authme.settings.properties;
import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.properties.BooleanProperty;
import ch.jalu.configme.properties.Property;
import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.settings.EnumSetProperty;
import java.util.Set;
import fr.xephi.authme.listener.PlayerQuitListener;
import static ch.jalu.configme.properties.PropertyInitializer.newLowercaseStringSetProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class SecuritySettings implements SettingsHolder {
@Comment({"Stop the server if we can't contact the sql database",
"Take care with this, if you set this to false,",
"AuthMe will automatically disable and the server won't be protected!"})
public static final Property<Boolean> STOP_SERVER_ON_PROBLEM =
newProperty("Security.SQLProblem.stopServer", false);
@Comment("Enable the new feature to prevent ghost players?")
public static final Property<Boolean> ANTI_GHOST_PLAYERS = newProperty("3rdPartyFeature.fixes.antiGhostPlayer", false);
@Comment({"Choose the best teleport method by server brand?",
"(Enable this if you are using Paper)"})
public static final Property<Boolean> SMART_ASYNC_TELEPORT = newProperty("3rdPartyFeature.optimizes.smartAsyncTeleport",false);
@Comment("Send a GUI captcha to unregistered players?(Requires ProtocolLib)")
public static final Property<Boolean> GUI_CAPTCHA = newProperty("3rdPartyFeature.captcha.guiCaptcha",false);
@Comment({"Should we kick the players when they don't finish the GUI captcha in seconds?",
"(less than or equals 0 is disabled)"})
public static final Property<Integer> GUI_CAPTCHA_TIMEOUT = newProperty("3rdPartyFeature.captcha.timeOut",0);
@Comment({"Should we ignore floodgate players when sending GUI captcha?",
"(require hookFloodgate enabled)"})
public static final Property<Boolean> GUI_CAPTCHA_BE_COMPATIBILITY = newProperty("3rdPartyFeature.captcha.ignoreBedrock",false);
// @Comment({"Should we kick the players when they failed captcha too many times?",
// "(Set this to 0 to disable)(Default: 4)"})
// public static final Property<Integer> GUI_CAPTCHA_MAX_TRY = newProperty("3rdPartyFeature.captcha.maxTryTimes",4);
// @Comment({"Kick the players when they didn't finish the gui captcha in time? " ,
// "(0 is disabled)"})
// public static final Property<Integer> CAPTCHA_TIMEOUT = newProperty("3rdPartyFeature.captcha.timeout",0);
//@Comment({"Using which API to get hash data?",
//"Available options: github, gitee, ghproxy (if your server is in China, please use gitee or ghproxy.)"})
//public static final Property<String> SHA_CHECK_METHOD = newProperty("Plugin.hashing.hashApi","github");
//@Comment("Should we use the local cache sometimes instead of requesting API?")
//public static final Property<Boolean> USE_LOCAL_CACHE = newProperty("Plugin.hashing.useLocalCache",false);
//@Comment("DON'T TOUCH!!!")
//public static final Property<String> SHA_CHECK_CACHE = newProperty("Plugin.hashing.hashCached","");
@Comment("Copy AuthMe log output in a separate file as well?")
public static final Property<Boolean> USE_LOGGING =
newProperty("Security.console.logConsole", true);
@Comment({"Query haveibeenpwned.com with a hashed version of the password.",
"This is used to check whether it is safe."})
public static final Property<Boolean> HAVE_I_BEEN_PWNED_CHECK =
newProperty("Security.account.haveIBeenPwned.check", false);
@Comment({"If the password is used more than this number of times, it is considered unsafe."})
public static final Property<Integer> HAVE_I_BEEN_PWNED_LIMIT =
newProperty("Security.account.haveIBeenPwned.limit", 0);
@Comment("Enable captcha when a player uses wrong password too many times")
public static final Property<Boolean> ENABLE_LOGIN_FAILURE_CAPTCHA =
newProperty("Security.captcha.useCaptcha", false);
@Comment("Check for updates on enabled from GitHub?")
public static final Property<Boolean> CHECK_FOR_UPDATES =
newProperty("Plugin.updates.checkForUpdates", true);
@Comment("Max allowed tries before a captcha is required")
public static final Property<Integer> MAX_LOGIN_TRIES_BEFORE_CAPTCHA =
newProperty("Security.captcha.maxLoginTry", 8);
@Comment("Captcha length")
public static final Property<Integer> CAPTCHA_LENGTH =
newProperty("Security.captcha.captchaLength", 6);
@Comment("Minutes after which login attempts count is reset for a player")
public static final Property<Integer> CAPTCHA_COUNT_MINUTES_BEFORE_RESET =
newProperty("Security.captcha.captchaCountReset", 120);
@Comment("Require captcha before a player may register?")
public static final Property<Boolean> ENABLE_CAPTCHA_FOR_REGISTRATION =
newProperty("Security.captcha.requireForRegistration", false);
@Comment("Minimum length of password")
public static final Property<Integer> MIN_PASSWORD_LENGTH =
newProperty("settings.security.minPasswordLength", 8);
@Comment("Maximum length of password")
public static final Property<Integer> MAX_PASSWORD_LENGTH =
newProperty("settings.security.passwordMaxLength", 26);
@Comment({
"Possible values: SHA256, BCRYPT, BCRYPT2Y, PBKDF2, SALTEDSHA512,",
"MYBB, IPB3, PHPBB, PHPFUSION, SMF, XENFORO, XAUTH, JOOMLA, WBB3, WBB4, MD5VB,",
"PBKDF2DJANGO, WORDPRESS, ROYALAUTH, ARGON2, CUSTOM (for developers only). See full list at",
"https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/hash_algorithms.md",
"If you use ARGON2, check that you have the argon2 c library on your system"
})
public static final Property<HashAlgorithm> PASSWORD_HASH =
newProperty(HashAlgorithm.class, "settings.security.passwordHash", HashAlgorithm.SHA256);
@Comment({
"If a password check fails, AuthMe will also try to check with the following hash methods.",
"Use this setting when you change from one hash method to another.",
"AuthMe will update the password to the new hash. Example:",
"legacyHashes:",
"- 'SHA1'"
})
public static final Property<Set<HashAlgorithm>> LEGACY_HASHES =
new EnumSetProperty<>(HashAlgorithm.class, "settings.security.legacyHashes");
@Comment("Salt length for the SALTED2MD5 MD5(MD5(password)+salt)")
public static final Property<Integer> DOUBLE_MD5_SALT_LENGTH =
newProperty("settings.security.doubleMD5SaltLength", 8);
@Comment("Number of rounds to use if passwordHash is set to PBKDF2. Default is 10000")
public static final Property<Integer> PBKDF2_NUMBER_OF_ROUNDS =
newProperty("settings.security.pbkdf2Rounds", 10000);
@Comment({"Prevent unsafe passwords from being used; put them in lowercase!",
"You should always set 'help' as unsafePassword due to possible conflicts.",
"unsafePasswords:",
"- '123456'",
"- 'password'",
"- 'help'"})
public static final Property<Set<String>> UNSAFE_PASSWORDS =
newLowercaseStringSetProperty("settings.security.unsafePasswords",
"12345678", "password", "qwertyui", "123456789", "87654321", "1234567890", "asdfghjkl","zxcvbnm,","asdfghjk","12312312","123123123","32132132","321321321");
@Comment("Tempban a user's IP address if they enter the wrong password too many times")
public static final Property<Boolean> TEMPBAN_ON_MAX_LOGINS =
newProperty("Security.tempban.enableTempban", false);
@Comment("How many times a user can attempt to login before their IP being tempbanned")
public static final Property<Integer> MAX_LOGIN_TEMPBAN =
newProperty("Security.tempban.maxLoginTries", 8);
@Comment({"The length of time a IP address will be tempbanned in minutes",
"Default: 480 minutes, or 8 hours"})
public static final Property<Integer> TEMPBAN_LENGTH =
newProperty("Security.tempban.tempbanLength", 480);
@Comment({"How many minutes before resetting the count for failed logins by IP and username",
"Default: 480 minutes (8 hours)"})
public static final Property<Integer> TEMPBAN_MINUTES_BEFORE_RESET =
newProperty("Security.tempban.minutesBeforeCounterReset", 480);
@Comment({"The command to execute instead of using the internal ban system, empty if disabled.",
"Available placeholders: %player%, %ip%"})
public static final Property<String> TEMPBAN_CUSTOM_COMMAND =
newProperty("Security.tempban.customCommand", "");
@Comment("Number of characters a recovery code should have (0 to disable)")
public static final Property<Integer> RECOVERY_CODE_LENGTH =
newProperty("Security.recoveryCode.length", 8);
@Comment("How many hours is a recovery code valid for?")
public static final Property<Integer> RECOVERY_CODE_HOURS_VALID =
newProperty("Security.recoveryCode.validForHours", 6);
@Comment("Max number of tries to enter recovery code")
public static final Property<Integer> RECOVERY_CODE_MAX_TRIES =
newProperty("Security.recoveryCode.maxTries", 4);
@Comment({"How long a player has after password recovery to change their password",
"without logging in. This is in minutes.",
"Default: 2 minutes"})
public static final Property<Integer> PASSWORD_CHANGE_TIMEOUT =
newProperty("Security.recoveryCode.passwordChangeTimeout", 5);
@Comment({
"Seconds a user has to wait for before a password recovery mail may be sent again",
"This prevents an attacker from abusing AuthMe's email feature."
})
public static final Property<Integer> EMAIL_RECOVERY_COOLDOWN_SECONDS =
newProperty("Security.emailRecovery.cooldown", 60);
@Comment({
"The mail shown using /email show will be partially hidden",
"E.g. (if enabled)",
" original email: my.email@example.com",
" hidden email: my.***@***mple.com"
})
public static final Property<Boolean> USE_EMAIL_MASKING =
newProperty("Security.privacy.enableEmailMasking", false);
@Comment("Minutes after which a verification code will expire")
public static final Property<Integer> VERIFICATION_CODE_EXPIRATION_MINUTES =
newProperty("Security.privacy.verificationCodeExpiration", 10);
private SecuritySettings() {
}
}