All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m28s
48 lines
1.2 KiB
Java
48 lines
1.2 KiB
Java
package cc.fascinated.bat.features;
|
|
|
|
import cc.fascinated.bat.command.BatCommand;
|
|
import cc.fascinated.bat.service.CommandService;
|
|
import lombok.Getter;
|
|
import lombok.NonNull;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.lang.reflect.Member;
|
|
|
|
/**
|
|
* @author Fascinated (fascinated7)
|
|
*/
|
|
@RequiredArgsConstructor
|
|
@Getter
|
|
@Component
|
|
public abstract class Feature {
|
|
/**
|
|
* The name of the feature
|
|
*/
|
|
private final String name;
|
|
|
|
/**
|
|
* The default state of the feature
|
|
*/
|
|
private final FeatureProfile.FeatureState defaultState;
|
|
|
|
/**
|
|
* The description of the feature
|
|
*/
|
|
public final boolean canBeDisabled;
|
|
|
|
/**
|
|
* Registers the command for the feature
|
|
*
|
|
* @param commandService The command service
|
|
* @param command The command to register
|
|
*/
|
|
public void registerCommand(@NonNull CommandService commandService, @NonNull BatCommand command) {
|
|
command.setFeature(this);
|
|
for (BatCommand subCommand : command.getSubCommands().values()) {
|
|
subCommand.setFeature(this);
|
|
}
|
|
commandService.registerCommand(command);
|
|
}
|
|
}
|