mirror of
				https://e.coding.net/circlecloud/YumCore.git
				synced 2025-11-03 23:06:02 +00:00 
			
		
		
		
	@@ -7,7 +7,7 @@ import java.lang.annotation.RetentionPolicy;
 | 
				
			|||||||
import java.lang.annotation.Target;
 | 
					import java.lang.annotation.Target;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 忽略配置保存
 | 
					 * 只读配置
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @author 喵♂呜
 | 
					 * @author 喵♂呜
 | 
				
			||||||
 * @since 2016年10月24日 上午00:11
 | 
					 * @since 2016年10月24日 上午00:11
 | 
				
			||||||
@@ -15,5 +15,5 @@ import java.lang.annotation.Target;
 | 
				
			|||||||
@Target(ElementType.FIELD)
 | 
					@Target(ElementType.FIELD)
 | 
				
			||||||
@Documented
 | 
					@Documented
 | 
				
			||||||
@Retention(RetentionPolicy.RUNTIME)
 | 
					@Retention(RetentionPolicy.RUNTIME)
 | 
				
			||||||
public @interface NotSave {
 | 
					public @interface ReadOnly {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -14,8 +14,8 @@ import pw.yumc.YumCore.bukkit.Log;
 | 
				
			|||||||
import pw.yumc.YumCore.commands.exception.CommandParseException;
 | 
					import pw.yumc.YumCore.commands.exception.CommandParseException;
 | 
				
			||||||
import pw.yumc.YumCore.config.annotation.ConfigNode;
 | 
					import pw.yumc.YumCore.config.annotation.ConfigNode;
 | 
				
			||||||
import pw.yumc.YumCore.config.annotation.Default;
 | 
					import pw.yumc.YumCore.config.annotation.Default;
 | 
				
			||||||
import pw.yumc.YumCore.config.annotation.NotSave;
 | 
					 | 
				
			||||||
import pw.yumc.YumCore.config.annotation.Nullable;
 | 
					import pw.yumc.YumCore.config.annotation.Nullable;
 | 
				
			||||||
 | 
					import pw.yumc.YumCore.config.annotation.ReadOnly;
 | 
				
			||||||
import pw.yumc.YumCore.config.exception.ConfigParseException;
 | 
					import pw.yumc.YumCore.config.exception.ConfigParseException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -192,7 +192,7 @@ public abstract class AbstractInjectConfig {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    protected void setConfig(String path, Field field) {
 | 
					    protected void setConfig(String path, Field field) {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            if (field.getAnnotation(NotSave.class) == null) {
 | 
					            if (field.getAnnotation(ReadOnly.class) == null) {
 | 
				
			||||||
                config.set(path, field.get(this));
 | 
					                config.set(path, field.get(this));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } catch (IllegalArgumentException | IllegalAccessException e) {
 | 
					        } catch (IllegalArgumentException | IllegalAccessException e) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user