From 23422ac23d158db89b67aefa1a5e5b1ad1367a68 Mon Sep 17 00:00:00 2001 From: Wyvest <45589059+Wyvest@users.noreply.github.com> Date: Mon, 27 Jun 2022 17:23:58 +0700 Subject: support classes for exclude annotation --- src/main/java/cc/polyfrost/oneconfig/config/Config.java | 4 ++++ src/main/java/cc/polyfrost/oneconfig/config/annotations/Exclude.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/java/cc/polyfrost') diff --git a/src/main/java/cc/polyfrost/oneconfig/config/Config.java b/src/main/java/cc/polyfrost/oneconfig/config/Config.java index f864d71..dc9f186 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/Config.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/Config.java @@ -264,6 +264,10 @@ public class Config { */ @Override public boolean shouldSkipClass(Class clazz) { + Exclude annotation = clazz.getAnnotation(Exclude.class); + if (annotation != null) { + return annotation.type() != Exclude.ExcludeType.HUD; + } return false; } } diff --git a/src/main/java/cc/polyfrost/oneconfig/config/annotations/Exclude.java b/src/main/java/cc/polyfrost/oneconfig/config/annotations/Exclude.java index 6ffd1d9..eddb490 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/annotations/Exclude.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/annotations/Exclude.java @@ -12,7 +12,7 @@ import java.lang.annotation.Target; * This can be used interchangeably with the transient modifier built into Java. */ @Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) +@Target({ElementType.FIELD, ElementType.TYPE}) public @interface Exclude { ExcludeType type() default ExcludeType.ALL; -- cgit