mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-29 20:17:36 +01:00
Code householding - remove legacy settings and TODO messages
- Remove fields in legacy settings that are now unused - Remove various irrelevant todo messages - Reduce visibility on some elements
This commit is contained in:
parent
e54cd526de
commit
6341d00df0
@ -120,7 +120,6 @@ public class HelpProvider implements SettingsDependent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void printAlternatives(CommandDescription command, List<String> correctLabels, List<String> lines) {
|
private static void printAlternatives(CommandDescription command, List<String> correctLabels, List<String> lines) {
|
||||||
// TODO ljacqu 20151219: Need to show alternatives for base labels too? E.g. /r for /register
|
|
||||||
if (command.getLabels().size() <= 1 || correctLabels.size() <= 1) {
|
if (command.getLabels().size() <= 1 || correctLabels.size() <= 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,6 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
|
|||||||
private BukkitService bukkitService;
|
private BukkitService bukkitService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
// TODO ljacqu 20160520: Need to check whether we want to inject PluginManager, or some intermediate service
|
|
||||||
private PluginManager pluginManager;
|
private PluginManager pluginManager;
|
||||||
|
|
||||||
private final boolean restoreCollisions = MethodUtils
|
private final boolean restoreCollisions = MethodUtils
|
||||||
|
@ -37,7 +37,7 @@ public class ProcessSyncEmailRegister implements SynchronousProcess {
|
|||||||
@Inject
|
@Inject
|
||||||
private AuthMe authMe;
|
private AuthMe authMe;
|
||||||
|
|
||||||
public ProcessSyncEmailRegister() { }
|
ProcessSyncEmailRegister() { }
|
||||||
|
|
||||||
public void processEmailRegister(Player player) {
|
public void processEmailRegister(Player player) {
|
||||||
final String name = player.getName().toLowerCase();
|
final String name = player.getName().toLowerCase();
|
||||||
|
@ -151,7 +151,7 @@ public class PasswordSecurity implements Reloadable {
|
|||||||
*
|
*
|
||||||
* @return The associated encryption method, or null if CUSTOM / deprecated
|
* @return The associated encryption method, or null if CUSTOM / deprecated
|
||||||
*/
|
*/
|
||||||
public EncryptionMethod initializeEncryptionMethod(HashAlgorithm algorithm) {
|
private EncryptionMethod initializeEncryptionMethod(HashAlgorithm algorithm) {
|
||||||
if (HashAlgorithm.CUSTOM.equals(algorithm) || HashAlgorithm.PLAINTEXT.equals(algorithm)) {
|
if (HashAlgorithm.CUSTOM.equals(algorithm) || HashAlgorithm.PLAINTEXT.equals(algorithm)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package fr.xephi.authme.settings;
|
package fr.xephi.authme.settings;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.security.HashAlgorithm;
|
|
||||||
import fr.xephi.authme.settings.domain.Property;
|
import fr.xephi.authme.settings.domain.Property;
|
||||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||||
@ -11,37 +10,45 @@ import fr.xephi.authme.settings.properties.SecuritySettings;
|
|||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Old settings manager. See {@link NewSetting} for the new manager.
|
* Old settings manager. See {@link NewSetting} for the new manager.
|
||||||
*/
|
*/
|
||||||
public final class Settings {
|
public final class Settings {
|
||||||
|
|
||||||
public static List<String> allowCommands;
|
|
||||||
public static List<String> getUnrestrictedName;
|
public static List<String> getUnrestrictedName;
|
||||||
public static List<String> getForcedWorlds;
|
public static List<String> getForcedWorlds;
|
||||||
public static List<String> countries;
|
public static boolean isPermissionCheckEnabled;
|
||||||
public static List<String> countriesBlacklist;
|
public static boolean isForcedRegistrationEnabled;
|
||||||
public static HashAlgorithm getPasswordHash;
|
public static boolean isTeleportToSpawnEnabled;
|
||||||
public static Pattern nickPattern;
|
public static boolean isSessionsEnabled;
|
||||||
public static boolean isPermissionCheckEnabled,
|
public static boolean isAllowRestrictedIp;
|
||||||
isForcedRegistrationEnabled, isTeleportToSpawnEnabled,
|
public static boolean isForceSpawnLocOnJoinEnabled;
|
||||||
isSessionsEnabled, isAllowRestrictedIp,
|
public static boolean isSaveQuitLocationEnabled;
|
||||||
isForceSingleSessionEnabled, isForceSpawnLocOnJoinEnabled,
|
public static boolean protectInventoryBeforeLogInEnabled;
|
||||||
isSaveQuitLocationEnabled, protectInventoryBeforeLogInEnabled,
|
public static boolean isStopEnabled;
|
||||||
isStopEnabled, reloadSupport, rakamakUseIp,
|
public static boolean reloadSupport;
|
||||||
removePassword, multiverse, bungee,
|
public static boolean rakamakUseIp;
|
||||||
enableProtection, forceRegLogin, noTeleport,
|
public static boolean removePassword;
|
||||||
allowAllCommandsIfRegIsOptional, isRemoveSpeedEnabled;
|
public static boolean multiverse;
|
||||||
public static String getNickRegex, getUnloggedinGroup,
|
public static boolean bungee;
|
||||||
unRegisteredGroup, backupWindowsPath, getRegisteredGroup,
|
public static boolean forceRegLogin;
|
||||||
rakamakUsers, rakamakUsersIp, defaultWorld, crazyloginFileName;
|
public static boolean noTeleport;
|
||||||
public static int getSessionTimeout, getMaxNickLength, getMinNickLength,
|
public static boolean isRemoveSpeedEnabled;
|
||||||
getNonActivatedGroup, maxLoginTry, captchaLength, getMaxLoginPerIp;
|
public static String getUnloggedinGroup;
|
||||||
protected static FileConfiguration configFile;
|
public static String unRegisteredGroup;
|
||||||
|
public static String getRegisteredGroup;
|
||||||
|
public static String rakamakUsers;
|
||||||
|
public static String rakamakUsersIp;
|
||||||
|
public static String defaultWorld;
|
||||||
|
public static String crazyloginFileName;
|
||||||
|
public static int getSessionTimeout;
|
||||||
|
public static int getNonActivatedGroup;
|
||||||
|
public static int maxLoginTry;
|
||||||
|
public static int captchaLength;
|
||||||
|
public static int getMaxLoginPerIp;
|
||||||
|
private static FileConfiguration configFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for Settings.
|
* Constructor for Settings.
|
||||||
@ -59,16 +66,10 @@ public final class Settings {
|
|||||||
isTeleportToSpawnEnabled = load(RestrictionSettings.TELEPORT_UNAUTHED_TO_SPAWN);
|
isTeleportToSpawnEnabled = load(RestrictionSettings.TELEPORT_UNAUTHED_TO_SPAWN);
|
||||||
isSessionsEnabled = load(PluginSettings.SESSIONS_ENABLED);
|
isSessionsEnabled = load(PluginSettings.SESSIONS_ENABLED);
|
||||||
getSessionTimeout = configFile.getInt("settings.sessions.timeout", 10);
|
getSessionTimeout = configFile.getInt("settings.sessions.timeout", 10);
|
||||||
getMaxNickLength = configFile.getInt("settings.restrictions.maxNicknameLength", 20);
|
|
||||||
getMinNickLength = configFile.getInt("settings.restrictions.minNicknameLength", 3);
|
|
||||||
getNickRegex = load(RestrictionSettings.ALLOWED_NICKNAME_CHARACTERS);
|
|
||||||
nickPattern = Pattern.compile(getNickRegex);
|
|
||||||
isAllowRestrictedIp = load(RestrictionSettings.ENABLE_RESTRICTED_USERS);
|
isAllowRestrictedIp = load(RestrictionSettings.ENABLE_RESTRICTED_USERS);
|
||||||
isRemoveSpeedEnabled = load(RestrictionSettings.REMOVE_SPEED);
|
isRemoveSpeedEnabled = load(RestrictionSettings.REMOVE_SPEED);
|
||||||
isForceSingleSessionEnabled = load(RestrictionSettings.FORCE_SINGLE_SESSION);
|
|
||||||
isForceSpawnLocOnJoinEnabled = load(RestrictionSettings.FORCE_SPAWN_LOCATION_AFTER_LOGIN);
|
isForceSpawnLocOnJoinEnabled = load(RestrictionSettings.FORCE_SPAWN_LOCATION_AFTER_LOGIN);
|
||||||
isSaveQuitLocationEnabled = configFile.getBoolean("settings.restrictions.SaveQuitLocation", false);
|
isSaveQuitLocationEnabled = configFile.getBoolean("settings.restrictions.SaveQuitLocation", false);
|
||||||
getPasswordHash = load(SecuritySettings.PASSWORD_HASH);
|
|
||||||
getUnloggedinGroup = load(SecuritySettings.UNLOGGEDIN_GROUP);
|
getUnloggedinGroup = load(SecuritySettings.UNLOGGEDIN_GROUP);
|
||||||
getNonActivatedGroup = configFile.getInt("ExternalBoardOptions.nonActivedUserGroup", -1);
|
getNonActivatedGroup = configFile.getInt("ExternalBoardOptions.nonActivedUserGroup", -1);
|
||||||
unRegisteredGroup = configFile.getString("GroupOptions.UnregisteredPlayerGroup", "");
|
unRegisteredGroup = configFile.getString("GroupOptions.UnregisteredPlayerGroup", "");
|
||||||
@ -80,20 +81,9 @@ public final class Settings {
|
|||||||
|
|
||||||
getRegisteredGroup = configFile.getString("GroupOptions.RegisteredPlayerGroup", "");
|
getRegisteredGroup = configFile.getString("GroupOptions.RegisteredPlayerGroup", "");
|
||||||
protectInventoryBeforeLogInEnabled = load(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN);
|
protectInventoryBeforeLogInEnabled = load(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN);
|
||||||
backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\");
|
|
||||||
isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true);
|
isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true);
|
||||||
reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true);
|
reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true);
|
||||||
|
|
||||||
allowAllCommandsIfRegIsOptional = load(RestrictionSettings.ALLOW_ALL_COMMANDS_IF_REGISTRATION_IS_OPTIONAL);
|
|
||||||
allowCommands = new ArrayList<>();
|
|
||||||
allowCommands.addAll(Arrays.asList("/login", "/l", "/register", "/reg", "/email", "/captcha"));
|
|
||||||
for (String cmd : configFile.getStringList("settings.restrictions.allowCommands")) {
|
|
||||||
cmd = cmd.toLowerCase();
|
|
||||||
if (!allowCommands.contains(cmd)) {
|
|
||||||
allowCommands.add(cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rakamakUsers = configFile.getString("Converter.Rakamak.fileName", "users.rak");
|
rakamakUsers = configFile.getString("Converter.Rakamak.fileName", "users.rak");
|
||||||
rakamakUsersIp = configFile.getString("Converter.Rakamak.ipFileName", "UsersIp.rak");
|
rakamakUsersIp = configFile.getString("Converter.Rakamak.ipFileName", "UsersIp.rak");
|
||||||
rakamakUseIp = configFile.getBoolean("Converter.Rakamak.useIp", false);
|
rakamakUseIp = configFile.getBoolean("Converter.Rakamak.useIp", false);
|
||||||
@ -104,9 +94,6 @@ public final class Settings {
|
|||||||
bungee = load(HooksSettings.BUNGEECORD);
|
bungee = load(HooksSettings.BUNGEECORD);
|
||||||
getForcedWorlds = load(RestrictionSettings.FORCE_SPAWN_ON_WORLDS);
|
getForcedWorlds = load(RestrictionSettings.FORCE_SPAWN_ON_WORLDS);
|
||||||
defaultWorld = configFile.getString("Purge.defaultWorld", "world");
|
defaultWorld = configFile.getString("Purge.defaultWorld", "world");
|
||||||
enableProtection = configFile.getBoolean("Protection.enableProtection", false);
|
|
||||||
countries = configFile.getStringList("Protection.countries");
|
|
||||||
countriesBlacklist = configFile.getStringList("Protection.countriesBlacklist");
|
|
||||||
forceRegLogin = load(RegistrationSettings.FORCE_LOGIN_AFTER_REGISTER);
|
forceRegLogin = load(RegistrationSettings.FORCE_LOGIN_AFTER_REGISTER);
|
||||||
getMaxLoginPerIp = load(RestrictionSettings.MAX_LOGIN_PER_IP);
|
getMaxLoginPerIp = load(RestrictionSettings.MAX_LOGIN_PER_IP);
|
||||||
noTeleport = load(RestrictionSettings.NO_TELEPORT);
|
noTeleport = load(RestrictionSettings.NO_TELEPORT);
|
||||||
|
@ -201,7 +201,6 @@ public class SpawnLoader implements SettingsDependent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean saveAuthMeConfig() {
|
private boolean saveAuthMeConfig() {
|
||||||
// TODO ljacqu 20160312: Investigate whether this utility should be put in a Utils class
|
|
||||||
try {
|
try {
|
||||||
authMeConfiguration.save(authMeConfigurationFile);
|
authMeConfiguration.save(authMeConfigurationFile);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user