From 1e7a3f571858aa40fdb01c56c8b443f99e92fb2a Mon Sep 17 00:00:00 2001 From: TudbuT Date: Tue, 18 Jun 2024 19:34:59 +0200 Subject: [PATCH] fix @Requires --- .../java/de/com/baseband/client/feature/Feature.java | 2 +- .../java/de/com/baseband/client/feature/Features.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Client/src/main/java/de/com/baseband/client/feature/Feature.java b/Client/src/main/java/de/com/baseband/client/feature/Feature.java index 650a788..8c4b232 100644 --- a/Client/src/main/java/de/com/baseband/client/feature/Feature.java +++ b/Client/src/main/java/de/com/baseband/client/feature/Feature.java @@ -340,7 +340,7 @@ public abstract class Feature extends ToggleButton implements SetCommand { public boolean canExist() { for (Class feature : required) { - if(!Features.isFeaturePresent(feature)) { + if(!Features.willFeatureExist(feature)) { return false; } } diff --git a/Client/src/main/java/de/com/baseband/client/feature/Features.java b/Client/src/main/java/de/com/baseband/client/feature/Features.java index d16901b..38313b5 100644 --- a/Client/src/main/java/de/com/baseband/client/feature/Features.java +++ b/Client/src/main/java/de/com/baseband/client/feature/Features.java @@ -25,6 +25,17 @@ public class Features { } } + public static boolean willFeatureExist(Class clazz) { + for (Feature feature : Setup.get().Features) { + if(feature.getClass() == clazz) { + if(feature.canExist()) { + return true; + } + } + } + return false; + } + public static boolean isFeaturePresent(Class clazz) { Feature f = getFeature(clazz); //noinspection ConstantValue