add checks for some events to see if the feature is enabled and more cleanup
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 39s
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 39s
This commit is contained in:
@ -50,7 +50,7 @@ public class DisableSubCommand extends BatSubCommand {
|
||||
return;
|
||||
}
|
||||
Feature feature = FeatureService.INSTANCE.getFeature(featureName);
|
||||
if (featureProfile.getFeatureState(feature) == FeatureProfile.FeatureState.DISABLED) {
|
||||
if (featureProfile.isFeatureDisabled(feature)) {
|
||||
interaction.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
.setDescription("The feature `%s` is already enabled".formatted(feature.getName()))
|
||||
.build()).queue();
|
||||
|
@ -50,7 +50,7 @@ public class EnableSubCommand extends BatSubCommand {
|
||||
return;
|
||||
}
|
||||
Feature feature = FeatureService.INSTANCE.getFeature(featureName);
|
||||
if (featureProfile.getFeatureState(feature) == FeatureProfile.FeatureState.ENABLED) {
|
||||
if (featureProfile.isFeatureEnabled(feature)) {
|
||||
interaction.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
.setDescription("The feature `%s` is already enabled".formatted(feature.getName()))
|
||||
.build()).queue();
|
||||
|
@ -40,6 +40,24 @@ public class FeatureProfile extends Profile {
|
||||
return this.featureStates.get(featureName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the feature is enabled
|
||||
*
|
||||
* @return the feature state
|
||||
*/
|
||||
public boolean isFeatureEnabled(Feature feature) {
|
||||
return this.getFeatureState(feature) == FeatureState.ENABLED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the feature is disabled
|
||||
*
|
||||
* @return the feature state
|
||||
*/
|
||||
public boolean isFeatureDisabled(Feature feature) {
|
||||
return this.getFeatureState(feature) == FeatureState.DISABLED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the feature
|
||||
*
|
||||
|
Reference in New Issue
Block a user