Move new configs outside of 'custom' package
- Create properties package for storing the config properties - Move NewSetting class to main settings pkg
This commit is contained in:
@@ -48,7 +48,7 @@ import fr.xephi.authme.security.crypts.HashedPassword;
|
||||
import fr.xephi.authme.settings.OtherAccounts;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.Spawn;
|
||||
import fr.xephi.authme.settings.custom.NewSetting;
|
||||
import fr.xephi.authme.settings.NewSetting;
|
||||
import fr.xephi.authme.util.GeoLiteAPI;
|
||||
import fr.xephi.authme.util.StringUtils;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
|
||||
@@ -8,7 +8,7 @@ import fr.xephi.authme.output.Messages;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.process.Management;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.settings.custom.NewSetting;
|
||||
import fr.xephi.authme.settings.NewSetting;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||
import fr.xephi.authme.settings.custom.RestrictionSettings;
|
||||
import fr.xephi.authme.settings.custom.SecuritySettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,7 +7,7 @@ import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
import fr.xephi.authme.security.crypts.HashedPassword;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.custom.SecuritySettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import fr.xephi.authme.command.CommandService;
|
||||
import fr.xephi.authme.command.PlayerCommand;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
import fr.xephi.authme.security.RandomString;
|
||||
import fr.xephi.authme.settings.custom.SecuritySettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.util.Wrapper;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.command.CommandService;
|
||||
import fr.xephi.authme.command.PlayerCommand;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
import fr.xephi.authme.settings.custom.RestrictionSettings;
|
||||
import fr.xephi.authme.settings.custom.SecuritySettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.settings.properties.SecuritySettings;
|
||||
import fr.xephi.authme.task.ChangePasswordTask;
|
||||
import fr.xephi.authme.util.Wrapper;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
package fr.xephi.authme.settings.custom;
|
||||
package fr.xephi.authme.settings;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
import fr.xephi.authme.settings.properties.SettingsFieldRetriever;
|
||||
import fr.xephi.authme.settings.propertymap.PropertyMap;
|
||||
import fr.xephi.authme.util.CollectionUtils;
|
||||
import fr.xephi.authme.util.StringUtils;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.xephi.authme.settings.custom;
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.xephi.authme.settings.custom;
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.xephi.authme.settings.custom;
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.xephi.authme.settings.custom;
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.xephi.authme.settings.custom;
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.xephi.authme.settings.custom;
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.xephi.authme.settings.custom;
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.xephi.authme.settings.custom;
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.xephi.authme.settings.custom;
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.xephi.authme.settings.custom;
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fr.xephi.authme.settings.custom;
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.security.HashAlgorithm;
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
+12
-5
@@ -1,4 +1,4 @@
|
||||
package fr.xephi.authme.settings.custom;
|
||||
package fr.xephi.authme.settings.properties;
|
||||
|
||||
import fr.xephi.authme.settings.domain.Comment;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
@@ -12,9 +12,10 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Utility class responsible for the retrieval of all {@link Property} fields via reflections.
|
||||
* Utility class responsible for retrieving all {@link Property} fields
|
||||
* from {@link SettingsClass} implementations via reflection.
|
||||
*/
|
||||
final class SettingsFieldRetriever {
|
||||
public final class SettingsFieldRetriever {
|
||||
|
||||
/** The classes to scan for properties. */
|
||||
private static final List<Class<? extends SettingsClass>> CONFIGURATION_CLASSES = Arrays.asList(
|
||||
@@ -37,7 +38,7 @@ final class SettingsFieldRetriever {
|
||||
for (Class<?> clazz : CONFIGURATION_CLASSES) {
|
||||
Field[] declaredFields = clazz.getDeclaredFields();
|
||||
for (Field field : declaredFields) {
|
||||
Property property = getFieldIfRelevant(field);
|
||||
Property property = getPropertyField(field);
|
||||
if (property != null) {
|
||||
properties.put(property, getCommentsForField(field));
|
||||
}
|
||||
@@ -53,7 +54,13 @@ final class SettingsFieldRetriever {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
private static Property<?> getFieldIfRelevant(Field field) {
|
||||
/**
|
||||
* Return the given field's value if it is a static {@link Property}.
|
||||
*
|
||||
* @param field The field's value to return
|
||||
* @return The property the field defines, or null if not applicable
|
||||
*/
|
||||
private static Property<?> getPropertyField(Field field) {
|
||||
field.setAccessible(true);
|
||||
if (field.isAccessible() && Property.class.equals(field.getType()) && Modifier.isStatic(field.getModifiers())) {
|
||||
try {
|
||||
Reference in New Issue
Block a user