mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-03-07 00:30:50 +00:00
[AB-xxx] adding/updating documentation for core and experience module
updating asciidoctor plugin version adding check to not allow duplicate level action configurations limiting experience level up notification toggle command to be only available if the feature mode is enabled
This commit is contained in:
@@ -18,6 +18,7 @@ import dev.sheldan.abstracto.core.service.management.UserInServerManagementServi
|
||||
import dev.sheldan.abstracto.experience.config.ExperienceFeatureDefinition;
|
||||
import dev.sheldan.abstracto.experience.config.ExperienceFeatureMode;
|
||||
import dev.sheldan.abstracto.experience.config.ExperienceSlashCommandNames;
|
||||
import dev.sheldan.abstracto.experience.exception.LevelActionAlreadyExistsException;
|
||||
import dev.sheldan.abstracto.experience.exception.LevelActionNotFoundException;
|
||||
import dev.sheldan.abstracto.experience.listener.LevelActionListener;
|
||||
import dev.sheldan.abstracto.experience.model.LevelActionPayload;
|
||||
@@ -99,6 +100,9 @@ public class AddLevelAction extends AbstractConditionableCommand {
|
||||
return userExperienceManagementService.saveUser(user);
|
||||
});
|
||||
}
|
||||
if(levelActionManagementService.getLevelAction(actionName, level, server, userExperience).isPresent()) {
|
||||
throw new LevelActionAlreadyExistsException();
|
||||
}
|
||||
levelActionManagementService.createLevelAction(level, server, actionName, userExperience, payload);
|
||||
return interactionService.replyEmbed(RESPONSE_TEMPLATE, event)
|
||||
.thenApply(interactionHook -> CommandResult.fromSuccess());
|
||||
|
||||
@@ -7,12 +7,14 @@ import dev.sheldan.abstracto.core.command.config.Parameter;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandContext;
|
||||
import dev.sheldan.abstracto.core.command.execution.CommandResult;
|
||||
import dev.sheldan.abstracto.core.config.FeatureDefinition;
|
||||
import dev.sheldan.abstracto.core.config.FeatureMode;
|
||||
import dev.sheldan.abstracto.core.interaction.InteractionService;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.SlashCommandConfig;
|
||||
import dev.sheldan.abstracto.core.interaction.slash.parameter.SlashCommandParameterService;
|
||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||
import dev.sheldan.abstracto.core.service.management.UserInServerManagementService;
|
||||
import dev.sheldan.abstracto.experience.config.ExperienceFeatureDefinition;
|
||||
import dev.sheldan.abstracto.experience.config.ExperienceFeatureMode;
|
||||
import dev.sheldan.abstracto.experience.config.ExperienceSlashCommandNames;
|
||||
import dev.sheldan.abstracto.experience.service.AUserExperienceService;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
@@ -100,4 +102,10 @@ public class ExpLevelUpNotification extends AbstractConditionableCommand {
|
||||
.help(helpInfo)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<FeatureMode> getFeatureModeLimitations() {
|
||||
return Arrays.asList(ExperienceFeatureMode.LEVEL_UP_NOTIFICATION);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package dev.sheldan.abstracto.experience.exception;
|
||||
|
||||
import dev.sheldan.abstracto.core.exception.AbstractoRunTimeException;
|
||||
import dev.sheldan.abstracto.core.templating.Templatable;
|
||||
|
||||
public class LevelActionAlreadyExistsException extends AbstractoRunTimeException implements Templatable {
|
||||
|
||||
public LevelActionAlreadyExistsException() {
|
||||
super("Level action already exists.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateName() {
|
||||
return "level_action_already_exists_exception";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTemplateModel() {
|
||||
return new Object();
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class Infractions extends AbstractConditionableCommand {
|
||||
} else if(slashCommandParameterService.hasCommandOptionWithFullType(USER_PARAMETER, event, OptionType.STRING)){
|
||||
String userIdStr = slashCommandParameterService.getCommandOption(USER_PARAMETER, event, User.class, String.class);
|
||||
Long userId = Long.parseLong(userIdStr);
|
||||
AUserInAServer userInServer = userInServerManagementService.createUserInServer(event.getGuild().getIdLong(), userId);
|
||||
AUserInAServer userInServer = userInServerManagementService.loadOrCreateUser(event.getGuild().getIdLong(), userId);
|
||||
infractions = infractionManagementService.getInfractionsForUser(userInServer);
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user