add checks for some events to see if the feature is enabled and more cleanup

This commit is contained in:
Lee
2024-06-30 08:24:14 +01:00
parent 22d4558d84
commit 6403c57db5
9 changed files with 74 additions and 6 deletions

View File

@ -70,6 +70,17 @@ public class FeatureService {
return features.get(name.toLowerCase());
}
/**
* Gets a feature by class
*
* @param clazz The class of the feature
* @return The feature
*/
public <T extends Feature> T getFeature(Class<T> clazz) {
Feature feature = features.values().stream().filter(featureClazz -> featureClazz.getClass().equals(clazz)).findFirst().orElse(null);
return clazz.cast(feature);
}
/**
* Checks if a feature is registered
*