forked from Fascinated/Bat
add checks for some events to see if the feature is enabled and more cleanup
This commit is contained in:
@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user