mirror of
				https://e.coding.net/circlecloud/YumCore.git
				synced 2025-11-03 23:06:02 +00:00 
			
		
		
		
	@@ -121,6 +121,9 @@ public abstract class AbstractInjectConfig {
 | 
				
			|||||||
        if (type.equals(String.class)) {
 | 
					        if (type.equals(String.class)) {
 | 
				
			||||||
            value = ChatColor.translateAlternateColorCodes('&', String.valueOf(value));
 | 
					            value = ChatColor.translateAlternateColorCodes('&', String.valueOf(value));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if (value != null && !type.isAssignableFrom(value.getClass())) {
 | 
				
			||||||
 | 
					            Log.w("字段 %s 默认类型为 %s 但解析后为 %s 可能存在转换错误!", field.getName(), type.getName(), value.getClass().getName());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        field.set(this, value);
 | 
					        field.set(this, value);
 | 
				
			||||||
        Log.d("设置字段 %s 为 %s ", field.getName(), value);
 | 
					        Log.d("设置字段 %s 为 %s ", field.getName(), value);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,5 @@
 | 
				
			|||||||
package pw.yumc.YumCore.config.inject;
 | 
					package pw.yumc.YumCore.config.inject;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.bukkit.configuration.ConfigurationSection;
 | 
					 | 
				
			||||||
import pw.yumc.YumCore.config.exception.ConfigParseException;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.text.DateFormat;
 | 
					import java.text.DateFormat;
 | 
				
			||||||
import java.text.ParseException;
 | 
					import java.text.ParseException;
 | 
				
			||||||
import java.text.SimpleDateFormat;
 | 
					import java.text.SimpleDateFormat;
 | 
				
			||||||
@@ -11,6 +8,10 @@ import java.util.HashMap;
 | 
				
			|||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.bukkit.configuration.ConfigurationSection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import pw.yumc.YumCore.config.exception.ConfigParseException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 注入配置类解析
 | 
					 * 注入配置类解析
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@@ -66,6 +67,7 @@ public class InjectParse {
 | 
				
			|||||||
    public static class DateFormatParse implements Parse<DateFormat> {
 | 
					    public static class DateFormatParse implements Parse<DateFormat> {
 | 
				
			||||||
        public DateFormatParse() {
 | 
					        public DateFormatParse() {
 | 
				
			||||||
            allparse.put(DateFormat.class, this);
 | 
					            allparse.put(DateFormat.class, this);
 | 
				
			||||||
 | 
					            allparse.put(SimpleDateFormat.class, this);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @Override
 | 
					        @Override
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user