#850 Fix export of legacy hashes property

- Ugly workaround due to #1014: need to have EnumSetProperty extend from StringListProperty type so that it is exported in a proper manner (as a string list). To get an enum Set we need to call a dedicated method on EnumSetProperty for the time being.
This commit is contained in:
ljacqu
2016-11-22 22:02:34 +01:00
parent 7d65d2a7c4
commit d2a28bdaed
4 changed files with 31 additions and 24 deletions
@@ -6,6 +6,7 @@ import fr.xephi.authme.events.PasswordEncryptionEvent;
import fr.xephi.authme.initialization.Reloadable;
import fr.xephi.authme.security.crypts.EncryptionMethod;
import fr.xephi.authme.security.crypts.HashedPassword;
import fr.xephi.authme.settings.EnumSetProperty;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.SecuritySettings;
import org.bukkit.plugin.PluginManager;
@@ -41,7 +42,8 @@ public class PasswordSecurity implements Reloadable {
@Override
public void reload() {
this.algorithm = settings.getProperty(SecuritySettings.PASSWORD_HASH);
this.legacyAlgorithms = settings.getProperty(SecuritySettings.LEGACY_HASHES);
// TODO #1014: Need to cast to specific type because ConfigMe ignores fields of child Property types
this.legacyAlgorithms = ((EnumSetProperty<HashAlgorithm>) SecuritySettings.LEGACY_HASHES).asEnumSet(settings);
}
/**