Bat/src/main/java/cc/fascinated/bat/features/Feature.java

40 lines
999 B
Java
Raw Normal View History

2024-06-25 15:43:36 +01:00
package cc.fascinated.bat.features;
2024-06-27 16:01:27 +01:00
import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.Category;
import cc.fascinated.bat.service.CommandService;
2024-06-25 15:43:36 +01:00
import lombok.Getter;
2024-06-27 16:01:27 +01:00
import lombok.NonNull;
2024-06-25 15:43:36 +01:00
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
/**
* @author Fascinated (fascinated7)
*/
@RequiredArgsConstructor
@Getter
@Component
public abstract class Feature {
/**
* The name of the feature
*/
private final String name;
2024-06-26 12:19:11 +01:00
/**
* The category of the feature
*/
private final Category category;
/**
2024-06-27 16:01:27 +01:00
* Registers the command for the feature
*
* @param commandService The command service
2024-06-28 03:01:21 +01:00
* @param command The command to register
2024-06-26 12:19:11 +01:00
*/
2024-06-27 16:01:27 +01:00
public void registerCommand(@NonNull CommandService commandService, @NonNull BatCommand command) {
command.setCategory(category);
2024-06-30 05:15:37 +01:00
command.setFeature(this);
2024-06-27 16:01:27 +01:00
commandService.registerCommand(command);
2024-06-26 12:19:11 +01:00
}
2024-06-25 15:43:36 +01:00
}