aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/config/gson/ProfileExclusionStrategy.java
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-28 17:29:26 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-28 17:29:26 +0700
commite85b11665a92e8a6bffb11b76b45ee3c97138bd2 (patch)
tree1e85d3673d6511df53b96deb8fc23989cd304722 /src/main/java/cc/polyfrost/oneconfig/config/gson/ProfileExclusionStrategy.java
parent61861be3663dc05883c387070c81eae9154444ef (diff)
downloadOneConfig-e85b11665a92e8a6bffb11b76b45ee3c97138bd2.tar.gz
OneConfig-e85b11665a92e8a6bffb11b76b45ee3c97138bd2.tar.bz2
OneConfig-e85b11665a92e8a6bffb11b76b45ee3c97138bd2.zip
revert funny diamond hud stuff
add ExcludeType again fix INSTANCE field stuff
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/config/gson/ProfileExclusionStrategy.java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/gson/ProfileExclusionStrategy.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/gson/ProfileExclusionStrategy.java b/src/main/java/cc/polyfrost/oneconfig/config/gson/ProfileExclusionStrategy.java
index c94e8bd..45f3a04 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/gson/ProfileExclusionStrategy.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/gson/ProfileExclusionStrategy.java
@@ -1,18 +1,22 @@
package cc.polyfrost.oneconfig.config.gson;
+import cc.polyfrost.oneconfig.config.Config;
import cc.polyfrost.oneconfig.config.annotations.Exclude;
import cc.polyfrost.oneconfig.config.annotations.NonProfileSpecific;
import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;
-public class ProfileExclusionStrategy implements ExclusionStrategy {
+public class ProfileExclusionStrategy extends ExclusionUtils implements ExclusionStrategy {
/**
* @param f the field object that is under test
* @return true if the field should be ignored; otherwise false
*/
@Override
public boolean shouldSkipField(FieldAttributes f) {
- return f.getAnnotation(NonProfileSpecific.class) != null || f.getAnnotation(Exclude.class) != null;
+ if (isSuperClassOf(f.getDeclaredClass(), Config.class)) return true;
+ if (f.getAnnotation(NonProfileSpecific.class) != null) return true;
+ Exclude exclude = f.getAnnotation(Exclude.class);
+ return exclude != null && exclude.type() != Exclude.ExcludeType.HUD;
}
/**
@@ -21,6 +25,7 @@ public class ProfileExclusionStrategy implements ExclusionStrategy {
*/
@Override
public boolean shouldSkipClass(Class<?> clazz) {
- return clazz.getAnnotation(NonProfileSpecific.class) != null || clazz.getAnnotation(Exclude.class) != null;
+ Exclude exclude = clazz.getAnnotation(Exclude.class);
+ return exclude != null && exclude.type() != Exclude.ExcludeType.HUD;
}
}