Upgrade to ConfigMe 0.2
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package fr.xephi.authme.settings;
|
||||
|
||||
import com.github.authme.configme.SettingsManager;
|
||||
import com.github.authme.configme.knownproperties.PropertyEntry;
|
||||
import com.github.authme.configme.knownproperties.ConfigurationData;
|
||||
import com.github.authme.configme.migration.MigrationService;
|
||||
import com.github.authme.configme.resource.PropertyResource;
|
||||
import com.google.common.io.Files;
|
||||
@@ -10,7 +10,6 @@ import fr.xephi.authme.ConsoleLogger;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
import static fr.xephi.authme.util.FileUtils.copyFileFromResource;
|
||||
|
||||
@@ -30,11 +29,11 @@ public class Settings extends SettingsManager {
|
||||
* @param pluginFolder the AuthMe plugin folder
|
||||
* @param resource the property resource to read and write properties to
|
||||
* @param migrationService migration service to check the settings file with
|
||||
* @param knownProperties collection of all available settings
|
||||
* @param configurationData configuration data (properties and comments)
|
||||
*/
|
||||
public Settings(File pluginFolder, PropertyResource resource, MigrationService migrationService,
|
||||
List<PropertyEntry> knownProperties) {
|
||||
super(resource, migrationService, knownProperties);
|
||||
ConfigurationData configurationData) {
|
||||
super(resource, migrationService, configurationData);
|
||||
this.pluginFolder = pluginFolder;
|
||||
loadSettingsFromFiles();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package fr.xephi.authme.settings;
|
||||
|
||||
import com.github.authme.configme.knownproperties.PropertyEntry;
|
||||
import com.github.authme.configme.migration.PlainMigrationService;
|
||||
import com.github.authme.configme.properties.Property;
|
||||
import com.github.authme.configme.resource.PropertyResource;
|
||||
@@ -35,7 +34,7 @@ public class SettingsMigrationService extends PlainMigrationService {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean performMigrations(PropertyResource resource, List<PropertyEntry> knownProperties) {
|
||||
protected boolean performMigrations(PropertyResource resource, List<Property<?>> properties) {
|
||||
boolean changes = false;
|
||||
if ("[a-zA-Z0-9_?]*".equals(resource.getString(ALLOWED_NICKNAME_CHARACTERS.getPath()))) {
|
||||
resource.setValue(ALLOWED_NICKNAME_CHARACTERS.getPath(), "[a-zA-Z0-9_]*");
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import com.github.authme.configme.SettingsHolder;
|
||||
import com.github.authme.configme.knownproperties.PropertyEntry;
|
||||
import com.github.authme.configme.knownproperties.PropertyFieldsCollector;
|
||||
import com.github.authme.configme.knownproperties.ConfigurationData;
|
||||
import com.github.authme.configme.knownproperties.ConfigurationDataBuilder;
|
||||
import com.github.authme.configme.properties.Property;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Utility class responsible for retrieving all {@link Property} fields
|
||||
* from {@link SettingsHolder} implementations via reflection.
|
||||
@@ -17,12 +15,12 @@ public final class AuthMeSettingsRetriever {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a list with all property fields in AuthMe {@link SettingsHolder} classes.
|
||||
* Builds the configuration data for all property fields in AuthMe {@link SettingsHolder} classes.
|
||||
*
|
||||
* @return list of all known properties
|
||||
* @return configuration data
|
||||
*/
|
||||
public static List<PropertyEntry> getAllPropertyFields() {
|
||||
return PropertyFieldsCollector.getAllProperties(
|
||||
public static ConfigurationData buildConfigurationData() {
|
||||
return ConfigurationDataBuilder.collectData(
|
||||
DatabaseSettings.class, ConverterSettings.class, PluginSettings.class,
|
||||
RestrictionSettings.class, EmailSettings.class, HooksSettings.class,
|
||||
ProtectionSettings.class, PurgeSettings.class, SecuritySettings.class,
|
||||
|
||||
Reference in New Issue
Block a user