aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-27 17:23:58 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-27 17:23:58 +0700
commit23422ac23d158db89b67aefa1a5e5b1ad1367a68 (patch)
tree90ebbbc3615cd93cc341bfcdc6206f5ed6b4b067
parent9afbfbc4c41bf8f90b5de901797e18375da2c01a (diff)
downloadOneConfig-23422ac23d158db89b67aefa1a5e5b1ad1367a68.tar.gz
OneConfig-23422ac23d158db89b67aefa1a5e5b1ad1367a68.tar.bz2
OneConfig-23422ac23d158db89b67aefa1a5e5b1ad1367a68.zip
support classes for exclude annotation
-rw-r--r--gradle.properties2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/Config.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/annotations/Exclude.java2
3 files changed, 6 insertions, 2 deletions
diff --git a/gradle.properties b/gradle.properties
index 257583c..7ea163e 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,6 +1,6 @@
mod_name = OneConfig
mod_id = oneconfig
-mod_version = 0.1.0-alpha29
+mod_version = 0.1.0-alpha31
essential.defaults.loom=0
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;