mirror of
				https://e.coding.net/circlecloud/YumCore.git
				synced 2025-11-03 23:06:02 +00:00 
			
		
		
		
	@@ -5,7 +5,6 @@ import java.lang.reflect.Field;
 | 
				
			|||||||
import java.lang.reflect.InvocationTargetException;
 | 
					import java.lang.reflect.InvocationTargetException;
 | 
				
			||||||
import java.lang.reflect.Modifier;
 | 
					import java.lang.reflect.Modifier;
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.Arrays;
 | 
					 | 
				
			||||||
import java.util.HashMap;
 | 
					import java.util.HashMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.bukkit.ChatColor;
 | 
					import org.bukkit.ChatColor;
 | 
				
			||||||
@@ -68,17 +67,10 @@ public abstract class AbstractInjectConfig {
 | 
				
			|||||||
     * @throws NoSuchMethodException
 | 
					     * @throws NoSuchMethodException
 | 
				
			||||||
     * @throws SecurityException
 | 
					     * @throws SecurityException
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private Object convertType(Class type, String path, Object value) throws IllegalAccessException, IllegalArgumentException, InstantiationException, InvocationTargetException, NoSuchMethodException, SecurityException {
 | 
					    private Object convertType(Class type, String path, Object value) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
 | 
				
			||||||
        switch (type.getName()) {
 | 
					 | 
				
			||||||
        case "java.lang.Integer":
 | 
					 | 
				
			||||||
            return Integer.valueOf(value.toString());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (type.isEnum()) {
 | 
					 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
                return Enum.valueOf(type, value.toString());
 | 
					            return type.getDeclaredMethod("valueOf", String.class).invoke(null, value);
 | 
				
			||||||
            } catch (IllegalArgumentException | NullPointerException ex) {
 | 
					        } catch (NoSuchMethodException | IllegalArgumentException ignored) {
 | 
				
			||||||
                throw new ConfigParseException(String.format("值 %s 无效! %s 有效值为 %s", value, type.getSimpleName(), Arrays.toString(type.getEnumConstants())));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (InjectConfigurationSection.class.isAssignableFrom(type)) {
 | 
					        if (InjectConfigurationSection.class.isAssignableFrom(type)) {
 | 
				
			||||||
            if (config.isConfigurationSection(path)) {
 | 
					            if (config.isConfigurationSection(path)) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user