cleanup features and move all misc commands into a base feature

This commit is contained in:
Lee 2024-06-30 08:00:03 +01:00
parent 5b1ddb145f
commit ea546f02ca
41 changed files with 122 additions and 47 deletions

@ -20,6 +20,11 @@ public abstract class Feature {
*/ */
private final String name; private final String name;
/**
* The description of the feature
*/
public final boolean canBeDisabled;
/** /**
* The category of the feature * The category of the feature
*/ */
@ -32,7 +37,10 @@ public abstract class Feature {
* @param command The command to register * @param command The command to register
*/ */
public void registerCommand(@NonNull CommandService commandService, @NonNull BatCommand command) { public void registerCommand(@NonNull CommandService commandService, @NonNull BatCommand command) {
command.setCategory(category); // If the command using the default category then set the category to the feature's category
if (command.getCategory() == Category.GENERAL) {
command.setCategory(this.category);
}
command.setFeature(this); command.setFeature(this);
commandService.registerCommand(command); commandService.registerCommand(command);
} }

@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class AfkFeature extends Feature { public class AfkFeature extends Feature {
public AfkFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public AfkFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("AFK", Category.GENERAL); super("AFK", true, Category.GENERAL);
registerCommand(commandService, context.getBean(AfkCommand.class)); registerCommand(commandService, context.getBean(AfkCommand.class));
} }

@ -16,7 +16,7 @@ import org.springframework.stereotype.Component;
public class AutoRoleFeature extends Feature { public class AutoRoleFeature extends Feature {
@Autowired @Autowired
public AutoRoleFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public AutoRoleFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Auto Role", Category.SERVER); super("Auto Role",true, Category.SERVER);
registerCommand(commandService, context.getBean(AutoRoleCommand.class)); registerCommand(commandService, context.getBean(AutoRoleCommand.class));
} }

@ -0,0 +1,43 @@
package cc.fascinated.bat.features.base;
import cc.fascinated.bat.command.Category;
import cc.fascinated.bat.features.Feature;
import cc.fascinated.bat.features.base.commands.botadmin.premium.PremiumAdminCommand;
import cc.fascinated.bat.features.base.commands.fun.image.ImageCommand;
import cc.fascinated.bat.features.base.commands.general.*;
import cc.fascinated.bat.features.base.commands.general.avatar.AvatarCommand;
import cc.fascinated.bat.features.base.commands.general.banner.BannerCommand;
import cc.fascinated.bat.features.base.commands.server.MemberCountCommand;
import cc.fascinated.bat.features.base.commands.server.PremiumCommand;
import cc.fascinated.bat.features.base.commands.server.channel.ChannelCommand;
import cc.fascinated.bat.features.base.commands.server.feature.FeatureCommand;
import cc.fascinated.bat.service.CommandService;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
/**
* @author Fascinated (fascinated7)
*/
@Component
public class BaseFeature extends Feature {
@Autowired
public BaseFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Base", false, Category.GENERAL);
super.registerCommand(commandService, context.getBean(PremiumCommand.class));
super.registerCommand(commandService, context.getBean(PremiumAdminCommand.class));
super.registerCommand(commandService, context.getBean(MemberCountCommand.class));
super.registerCommand(commandService, context.getBean(ChannelCommand.class));
super.registerCommand(commandService, context.getBean(VoteCommand.class));
super.registerCommand(commandService, context.getBean(PingCommand.class));
super.registerCommand(commandService, context.getBean(InviteCommand.class));
super.registerCommand(commandService, context.getBean(HelpCommand.class));
super.registerCommand(commandService, context.getBean(BotStatsCommand.class));
super.registerCommand(commandService, context.getBean(BannerCommand.class));
super.registerCommand(commandService, context.getBean(AvatarCommand.class));
super.registerCommand(commandService, context.getBean(ImageCommand.class));
super.registerCommand(commandService, context.getBean(FeatureCommand.class));
}
}

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.botadmin.premium; package cc.fascinated.bat.features.base.commands.botadmin.premium;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.Category; import cc.fascinated.bat.command.Category;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.botadmin.premium; package cc.fascinated.bat.features.base.commands.botadmin.premium;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.botadmin.premium; package cc.fascinated.bat.features.base.commands.botadmin.premium;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.fun.image; package cc.fascinated.bat.features.base.commands.fun.image;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.fun.image; package cc.fascinated.bat.features.base.commands.fun.image;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.fun.image; package cc.fascinated.bat.features.base.commands.fun.image;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.fun.image; package cc.fascinated.bat.features.base.commands.fun.image;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.fun.image; package cc.fascinated.bat.features.base.commands.fun.image;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.Category; import cc.fascinated.bat.command.Category;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.general; package cc.fascinated.bat.features.base.commands.general;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.general; package cc.fascinated.bat.features.base.commands.general;
import cc.fascinated.bat.Consts; import cc.fascinated.bat.Consts;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.general; package cc.fascinated.bat.features.base.commands.general;
import cc.fascinated.bat.Consts; import cc.fascinated.bat.Consts;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.general; package cc.fascinated.bat.features.base.commands.general;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.general; package cc.fascinated.bat.features.base.commands.general;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.general.avatar; package cc.fascinated.bat.features.base.commands.general.avatar;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.general.avatar; package cc.fascinated.bat.features.base.commands.general.avatar;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.general.avatar; package cc.fascinated.bat.features.base.commands.general.avatar;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.general.banner; package cc.fascinated.bat.features.base.commands.general.banner;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.general.banner; package cc.fascinated.bat.features.base.commands.general.banner;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.general.banner; package cc.fascinated.bat.features.base.commands.general.banner;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.server; package cc.fascinated.bat.features.base.commands.server;
import cc.fascinated.bat.Emojis; import cc.fascinated.bat.Emojis;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.server; package cc.fascinated.bat.features.base.commands.server;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.server.channel; package cc.fascinated.bat.features.base.commands.server.channel;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.Category; import cc.fascinated.bat.command.Category;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.server.channel; package cc.fascinated.bat.features.base.commands.server.channel;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.server.channel; package cc.fascinated.bat.features.base.commands.server.channel;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,4 +1,4 @@
package cc.fascinated.bat.command.impl.server.channel; package cc.fascinated.bat.features.base.commands.server.channel;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;

@ -1,10 +1,10 @@
package cc.fascinated.bat.features.command; package cc.fascinated.bat.features.base.commands.server.feature;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.features.Feature; import cc.fascinated.bat.features.Feature;
import cc.fascinated.bat.features.FeatureProfile; import cc.fascinated.bat.features.base.profile.FeatureProfile;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.FeatureService; import cc.fascinated.bat.service.FeatureService;
@ -50,6 +50,13 @@ public class DisableSubCommand extends BatSubCommand {
return; return;
} }
Feature feature = FeatureService.INSTANCE.getFeature(featureName); Feature feature = FeatureService.INSTANCE.getFeature(featureName);
if (!feature.isCanBeDisabled()) {
interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The feature `%s` cannot be disabled".formatted(feature.getName()))
.build()).queue();
return;
}
if (featureProfile.isFeatureDisabled(feature)) { if (featureProfile.isFeatureDisabled(feature)) {
interaction.replyEmbeds(EmbedUtils.errorEmbed() interaction.replyEmbeds(EmbedUtils.errorEmbed()
.setDescription("The feature `%s` is already disabled".formatted(feature.getName())) .setDescription("The feature `%s` is already disabled".formatted(feature.getName()))

@ -1,10 +1,10 @@
package cc.fascinated.bat.features.command; package cc.fascinated.bat.features.base.commands.server.feature;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.features.Feature; import cc.fascinated.bat.features.Feature;
import cc.fascinated.bat.features.FeatureProfile; import cc.fascinated.bat.features.base.profile.FeatureProfile;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.FeatureService; import cc.fascinated.bat.service.FeatureService;

@ -1,6 +1,7 @@
package cc.fascinated.bat.features.command; package cc.fascinated.bat.features.base.commands.server.feature;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.Category;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;
import lombok.NonNull; import lombok.NonNull;
import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.Permission;
@ -12,7 +13,7 @@ import org.springframework.stereotype.Component;
* @author Fascinated (fascinated7) * @author Fascinated (fascinated7)
*/ */
@Component @Component
@CommandInfo(name = "feature", description = "Configure features in your guild", requiredPermissions = Permission.ADMINISTRATOR) @CommandInfo(name = "feature", description = "Configure features in your guild", requiredPermissions = Permission.ADMINISTRATOR, category = Category.SERVER)
public class FeatureCommand extends BatCommand { public class FeatureCommand extends BatCommand {
@Autowired @Autowired
public FeatureCommand(@NonNull ApplicationContext context) { public FeatureCommand(@NonNull ApplicationContext context) {

@ -1,10 +1,10 @@
package cc.fascinated.bat.features.command; package cc.fascinated.bat.features.base.commands.server.feature;
import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.BatSubCommand;
import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.command.CommandInfo;
import cc.fascinated.bat.common.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.features.Feature; import cc.fascinated.bat.features.Feature;
import cc.fascinated.bat.features.FeatureProfile; import cc.fascinated.bat.features.base.profile.FeatureProfile;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.FeatureService; import cc.fascinated.bat.service.FeatureService;

@ -1,6 +1,7 @@
package cc.fascinated.bat.features; package cc.fascinated.bat.features.base.profile;
import cc.fascinated.bat.common.Profile; import cc.fascinated.bat.common.Profile;
import cc.fascinated.bat.features.Feature;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;

@ -23,7 +23,7 @@ public class BirthdayFeature extends Feature implements EventListener {
private final GuildService guildService; private final GuildService guildService;
public BirthdayFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService, @NonNull GuildService guildService) { public BirthdayFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService, @NonNull GuildService guildService) {
super("Birthday", Category.UTILITY); super("Birthday", true, Category.UTILITY);
this.guildService = guildService; this.guildService = guildService;
registerCommand(commandService, context.getBean(BirthdayCommand.class)); registerCommand(commandService, context.getBean(BirthdayCommand.class));

@ -2,6 +2,11 @@ package cc.fascinated.bat.features.namehistory;
import cc.fascinated.bat.command.Category; import cc.fascinated.bat.command.Category;
import cc.fascinated.bat.features.Feature; import cc.fascinated.bat.features.Feature;
import cc.fascinated.bat.features.namehistory.command.NameHistoryCommand;
import cc.fascinated.bat.service.CommandService;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
@ -11,7 +16,10 @@ import org.springframework.stereotype.Component;
public class NameHistoryFeature extends Feature { public class NameHistoryFeature extends Feature {
public static final int NAME_HISTORY_SIZE = 25; public static final int NAME_HISTORY_SIZE = 25;
public NameHistoryFeature() { @Autowired
super("Name History", Category.UTILITY); public NameHistoryFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Name History", true,Category.UTILITY);
super.registerCommand(commandService, context.getBean(NameHistoryCommand.class));
} }
} }

@ -26,7 +26,7 @@ import org.springframework.stereotype.Component;
public class ScoreSaberFeature extends Feature { public class ScoreSaberFeature extends Feature {
@Autowired @Autowired
public ScoreSaberFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) { public ScoreSaberFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("ScoreSaber", Category.BEAT_SABER); super("ScoreSaber", true, Category.BEAT_SABER);
registerCommand(commandService, context.getBean(ScoreSaberCommand.class)); registerCommand(commandService, context.getBean(ScoreSaberCommand.class));
registerCommand(commandService, context.getBean(UserFeedCommand.class)); registerCommand(commandService, context.getBean(UserFeedCommand.class));

@ -6,13 +6,16 @@ import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.SpotifyUtils; import cc.fascinated.bat.common.SpotifyUtils;
import cc.fascinated.bat.exception.BatException; import cc.fascinated.bat.exception.BatException;
import cc.fascinated.bat.features.Feature; import cc.fascinated.bat.features.Feature;
import cc.fascinated.bat.features.spotify.command.SpotifyCommand;
import cc.fascinated.bat.features.spotify.profile.SpotifyProfile; import cc.fascinated.bat.features.spotify.profile.SpotifyProfile;
import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.model.BatUser;
import cc.fascinated.bat.service.CommandService;
import cc.fascinated.bat.service.SpotifyService; import cc.fascinated.bat.service.SpotifyService;
import lombok.NonNull; import lombok.NonNull;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.EmbedBuilder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import se.michaelthelin.spotify.model_objects.miscellaneous.CurrentlyPlaying; import se.michaelthelin.spotify.model_objects.miscellaneous.CurrentlyPlaying;
import se.michaelthelin.spotify.model_objects.specification.AlbumSimplified; import se.michaelthelin.spotify.model_objects.specification.AlbumSimplified;
@ -25,8 +28,10 @@ import se.michaelthelin.spotify.model_objects.specification.Track;
@Component @Component
public class SpotifyFeature extends Feature { public class SpotifyFeature extends Feature {
@Autowired @Autowired
public SpotifyFeature() { public SpotifyFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Spotify", Category.MUSIC); super("Spotify", true,Category.MUSIC);
super.registerCommand(commandService, context.getBean(SpotifyCommand.class));
} }
/** /**

@ -1,7 +1,7 @@
package cc.fascinated.bat.model; package cc.fascinated.bat.model;
import cc.fascinated.bat.common.ProfileHolder; import cc.fascinated.bat.common.ProfileHolder;
import cc.fascinated.bat.features.FeatureProfile; import cc.fascinated.bat.features.base.profile.FeatureProfile;
import cc.fascinated.bat.features.namehistory.profile.guild.NameHistoryProfile; import cc.fascinated.bat.features.namehistory.profile.guild.NameHistoryProfile;
import cc.fascinated.bat.service.DiscordService; import cc.fascinated.bat.service.DiscordService;
import lombok.*; import lombok.*;

@ -4,7 +4,7 @@ import cc.fascinated.bat.Consts;
import cc.fascinated.bat.command.*; import cc.fascinated.bat.command.*;
import cc.fascinated.bat.common.EmbedUtils; import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.config.Config; import cc.fascinated.bat.config.Config;
import cc.fascinated.bat.features.FeatureProfile; import cc.fascinated.bat.features.base.profile.FeatureProfile;
import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatGuild;
import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.model.BatUser;
import lombok.Getter; import lombok.Getter;

@ -2,7 +2,7 @@ package cc.fascinated.bat.service;
import cc.fascinated.bat.command.BatCommand; import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.features.Feature; import cc.fascinated.bat.features.Feature;
import cc.fascinated.bat.features.command.FeatureCommand; import cc.fascinated.bat.features.base.commands.server.feature.FeatureCommand;
import jakarta.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
import lombok.Getter; import lombok.Getter;
import lombok.NonNull; import lombok.NonNull;
@ -50,7 +50,9 @@ public class FeatureService {
context.getBeansOfType(BatCommand.class) context.getBeansOfType(BatCommand.class)
.values() .values()
.forEach((command) -> { .forEach((command) -> {
commandService.registerCommand(context.getBean(command.getClass())); if (command.getFeature() == null) {
log.error("Command \"{}\" does not belong to a feature, not registering it...", command.getCommandInfo().name());
}
}); });
commandService.registerCommand(context.getBean(FeatureCommand.class)); commandService.registerCommand(context.getBean(FeatureCommand.class));