mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-05 00:53:04 +00:00
updated javadoc for experience tracking
added/changed some javadoc for mod mail some small interface changes changed a few methods to actually use the exists mechanic, instead of checking for null values added some templates instead of hard coded strings fixed some bugs related to mod mail
This commit is contained in:
@@ -16,6 +16,9 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Command used to add a role to the roles for which experience has been disabled.
|
||||
*/
|
||||
@Component
|
||||
public class DisableExpForRole extends AbstractConditionableCommand {
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Command used to disable the experience gain for a specific member
|
||||
*/
|
||||
@Component
|
||||
public class DisableExpGain extends AbstractConditionableCommand {
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Command used to remove a role from the list of roles for which experience is disabled
|
||||
*/
|
||||
@Component
|
||||
public class EnableExpForRole extends AbstractConditionableCommand {
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Command to enable experience again for a member
|
||||
*/
|
||||
@Component
|
||||
public class EnableExpGain extends AbstractConditionableCommand {
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Command used to change the experience multiplier on the server.
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ExpScale extends AbstractConditionableCommand {
|
||||
|
||||
@@ -24,6 +24,9 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Shows the experience gain information of the top 10 users in the server, or if a page number is provided as a parameter, only the members which are on this page.
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class LeaderBoardCommand extends AbstractConditionableCommand {
|
||||
|
||||
@@ -22,6 +22,9 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Creates an embed containing the roles for which the experience gain has been disabled.
|
||||
*/
|
||||
@Component
|
||||
public class ListDisabledExperienceRoles extends AbstractConditionableCommand {
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Command used to show an embed containing information about the experience amount, level and message count of a ember on a server
|
||||
*/
|
||||
@Component
|
||||
public class Rank extends AbstractConditionableCommand {
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Command used to define which commands are to be awarded at which level
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SetExpRole extends AbstractConditionableCommand {
|
||||
|
||||
@@ -17,6 +17,12 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Command used to synchronize the actual awarded roles which what is defined to be awarded in the database.
|
||||
* This also calculates the appropriate role for each user and then awards the role, while removing the previously awarded role.
|
||||
* The synchronization is usually a longer process, and there is a status message to see how far this progress is.
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SyncRoles extends AbstractConditionableCommand {
|
||||
|
||||
@@ -16,6 +16,10 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Command used to remove a role from the roles to be awarded at certain levels. If there are users with this role currently, their role
|
||||
* will be recalculated, and this will be shown with an status update message.
|
||||
*/
|
||||
@Component
|
||||
public class UnSetExpRole extends AbstractConditionableCommand {
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ public class ExperienceConfig {
|
||||
private Double expMultiplier;
|
||||
|
||||
/**
|
||||
* The defaul maxLevel from the properties file. This configuration applies globally, as the amount of levels does not depend on the server.
|
||||
* The default maxLevel from the properties file. This configuration applies globally, as the amount of levels does not depend on the server.
|
||||
* This is only used once, when creating the {@link dev.sheldan.abstracto.experience.models.database.AExperienceLevel} once
|
||||
*/
|
||||
private Integer maxLvl;
|
||||
}
|
||||
@@ -8,7 +8,11 @@ import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
/**
|
||||
* Bean used to define the default values for the required configuration in the experience module.
|
||||
* This {@link dev.sheldan.abstracto.core.models.database.ADefaultConfig} is used, when a config key in a module is set to the default value
|
||||
* This service only creates a value if no one is previously there.
|
||||
*/
|
||||
@Component
|
||||
public class ExperienceDefaultConfigListener {
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ExperienceLevelLoader {
|
||||
@EventListener
|
||||
public void handleContextRefreshEvent(ContextRefreshedEvent ctxStartEvt) {
|
||||
Integer maxLevel = experienceConfig.getMaxLvl();
|
||||
log.info("Setting up experience level configuration.");
|
||||
log.info("Creating experience levels up to level {}", maxLevel);
|
||||
experienceLevelService.createLevelsUntil(maxLevel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Converter used to conver from {@link LeaderBoard} to a list of {@link LeaderBoardEntryModel}
|
||||
* Converter used to convert from {@link LeaderBoard} to a list of {@link LeaderBoardEntryModel}
|
||||
*/
|
||||
@Component
|
||||
public class LeaderBoardModelConverter {
|
||||
@@ -23,10 +23,10 @@ public class LeaderBoardModelConverter {
|
||||
|
||||
/**
|
||||
* Converts the complete {@link LeaderBoard} into a list of {@link LeaderBoardEntryModel} which contain additional
|
||||
* information available for rendering the leaderboard ({@link Member} reference)
|
||||
* information available for rendering the leader board ({@link Member} reference and more)
|
||||
* @param leaderBoard The {@link LeaderBoard} object to be converted
|
||||
* @return The list of {@link LeaderBoardEntryModel} which contain the fully fledged information provided to the
|
||||
* leaderboard template
|
||||
* leader board template
|
||||
*/
|
||||
public List<LeaderBoardEntryModel> fromLeaderBoard(LeaderBoard leaderBoard) {
|
||||
List<LeaderBoardEntryModel> models = new ArrayList<>();
|
||||
|
||||
@@ -8,6 +8,9 @@ import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Repository to manage the access to the table managed by {@link ADisabledExpRole}
|
||||
*/
|
||||
@Repository
|
||||
public interface DisabledExpRoleRepository extends JpaRepository<ADisabledExpRole, Long> {
|
||||
boolean existsByRole(ARole role);
|
||||
|
||||
@@ -39,6 +39,8 @@ public interface UserExperienceRepository extends JpaRepository<AUserExperience
|
||||
|
||||
/**
|
||||
* This returns the {@link LeaderBoardEntryResult} object containing the information about the rank of a user in a server.
|
||||
* This query selects all the experience entries and returns the one associated with the provided user.
|
||||
* We need to select all of them, in order to find the rank of the member in the server
|
||||
* @param id The {@link dev.sheldan.abstracto.core.models.database.AUserInAServer} id to search for
|
||||
* @return the {@link LeaderBoardEntryResult} of this {@link dev.sheldan.abstracto.core.models.database.AUserInAServer}
|
||||
* containing rank and experience information
|
||||
@@ -50,6 +52,6 @@ public interface UserExperienceRepository extends JpaRepository<AUserExperience
|
||||
") " +
|
||||
"SELECT rank.id as \"id\", rank.experience as \"experience\", rank.message_count as \"messageCount\", rank.level_id as \"level\", rank.row_number as \"rank\" " +
|
||||
"FROM user_experience_ranked rank " +
|
||||
"where rank.id = :userInServerId", nativeQuery = true)
|
||||
"WHERE rank.id = :userInServerId", nativeQuery = true)
|
||||
LeaderBoardEntryResult getRankOfUserInServer(@Param("userInServerId") Long id);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class AUserExperienceServiceBean implements AUserExperienceService {
|
||||
|
||||
|
||||
/**
|
||||
* Calculates the level of the given {@link AUserExperience} accoring to the given {@link AExperienceLevel} list
|
||||
* Calculates the level of the given {@link AUserExperience} according to the given {@link AExperienceLevel} list
|
||||
* @param experience The {@link AUserExperience} to calculate the level for
|
||||
* @param levels The list of {@link AExperienceLevel} representing the level configuration, this must include the initial level 0
|
||||
* * This level will be taken as the initial value, and if no other level qualifies, this will be taken.
|
||||
@@ -243,6 +243,12 @@ public class AUserExperienceServiceBean implements AUserExperienceService {
|
||||
executeActionOnUserExperiencesWithFeedBack(aUserExperiences, channel, (AUserExperience experience) -> updateUserRole(experience, roles));
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the given {@link Consumer} on each of the experiences and provides feedback in the given AChannel in the form of a status message
|
||||
* @param experiences The list of {@link AUserExperience} to be working on
|
||||
* @param channel The {@link AChannel} used to provide feedback to the user
|
||||
* @param toExecute The {@link Consumer} which should be executed on each element of the passed list
|
||||
*/
|
||||
@Override
|
||||
public void executeActionOnUserExperiencesWithFeedBack(List<AUserExperience> experiences, AChannel channel, Consumer<AUserExperience> toExecute) {
|
||||
MessageToSend status = getUserSyncStatusUpdateModel(0, experiences.size());
|
||||
@@ -308,7 +314,7 @@ public class AUserExperienceServiceBean implements AUserExperienceService {
|
||||
}
|
||||
page--;
|
||||
int pageSize = 10;
|
||||
List<AUserExperience> experiences = userExperienceManagementService.findLeaderboardUsersPaginated(server, page * pageSize, (page + 1) * pageSize);
|
||||
List<AUserExperience> experiences = userExperienceManagementService.findLeaderBoardUsersPaginated(server, page * pageSize, (page + 1) * pageSize);
|
||||
List<LeaderBoardEntry> entries = new ArrayList<>();
|
||||
for (int i = 0; i < experiences.size(); i++) {
|
||||
AUserExperience userExperience = experiences.get(i);
|
||||
|
||||
@@ -14,6 +14,11 @@ public class ExperienceLevelServiceBean implements ExperienceLevelService {
|
||||
@Autowired
|
||||
private ExperienceLevelManagementService experienceLevelManagementService;
|
||||
|
||||
/**
|
||||
* Creates experience level if it does not yet exist.
|
||||
* @param level The level to create
|
||||
* @param experienceNeeded The total amount of experience needed to reach the given level
|
||||
*/
|
||||
private void createExperienceLevel(Integer level, Long experienceNeeded) {
|
||||
if(!experienceLevelManagementService.levelExists(level)) {
|
||||
log.trace("Creating new experience level {} with experience needed {}.", level, experienceNeeded);
|
||||
@@ -41,6 +46,7 @@ public class ExperienceLevelServiceBean implements ExperienceLevelService {
|
||||
* @param level The level to calculate the experience amount for
|
||||
* @return The needed experience to reach this level, if the user already has the level below the passed one
|
||||
*/
|
||||
@Override
|
||||
public Long calculateExperienceForLevel(Integer level) {
|
||||
if(level < 0) {
|
||||
throw new IllegalArgumentException("Level should not be less to 0.");
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ExperienceRoleManagementServiceBean implements ExperienceRoleManage
|
||||
private ExperienceRoleRepository experienceRoleRepository;
|
||||
|
||||
/**
|
||||
* Removes all assignments of roles for the given level
|
||||
* Removes *all* assignments of roles for the given level
|
||||
* @param level The level to remove the roles for
|
||||
* @param server The server in which this should happen
|
||||
*/
|
||||
@@ -45,6 +45,12 @@ public class ExperienceRoleManagementServiceBean implements ExperienceRoleManage
|
||||
return experienceRoleRepository.findByRoleServer(server);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new role if nothing is found, and if its found the experience role will be set to the given level.
|
||||
* @param level The {@link AExperienceLevel} to set the role for
|
||||
* @param role The {@link ARole} to set to
|
||||
* @return The created/updated {@link AExperienceRole}
|
||||
*/
|
||||
@Override
|
||||
public AExperienceRole setLevelToRole(AExperienceLevel level, ARole role) {
|
||||
AExperienceRole byRoleServerAndRole = experienceRoleRepository.findByRole(role);
|
||||
|
||||
@@ -30,6 +30,11 @@ public class UserExperienceManagementServiceBean implements UserExperienceManage
|
||||
return byId.orElseGet(() -> createUserInServer(aUserInAServer));
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the {@link AUserExperience} with default values the following: 0 experience, 0 messages and experience gain enabled
|
||||
* @param aUserInAServer The {@link AUserInAServer} to create the {@link AUserExperience} object for.
|
||||
* @return The created/changed {@link AUserExperience} object
|
||||
*/
|
||||
@Override
|
||||
public AUserExperience createUserInServer(AUserInAServer aUserInAServer) {
|
||||
AExperienceLevel startingLevel = experienceLevelManagementService.getLevel(0).orElseThrow(() -> new AbstractoRunTimeException(String.format("Could not find level %s", 0)));
|
||||
@@ -81,7 +86,7 @@ public class UserExperienceManagementServiceBean implements UserExperienceManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AUserExperience> findLeaderboardUsersPaginated(AServer aServer, Integer start, Integer end) {
|
||||
public List<AUserExperience> findLeaderBoardUsersPaginated(AServer aServer, Integer start, Integer end) {
|
||||
return repository.findTop10ByUser_ServerReferenceOrderByExperienceDesc(aServer, PageRequest.of(start, end));
|
||||
}
|
||||
|
||||
|
||||
@@ -583,7 +583,7 @@ public class AUserExperienceServiceBeanTest extends ExperienceRelatedTest {
|
||||
private void executeLeaderBoardTest(AServer server, Integer page) {
|
||||
int pageSize = 10;
|
||||
List<AUserExperience> experiences = getUserExperiences(pageSize, server);
|
||||
when(userExperienceManagementService.findLeaderboardUsersPaginated(server, (page - 1) * pageSize, page * pageSize)).thenReturn(experiences);
|
||||
when(userExperienceManagementService.findLeaderBoardUsersPaginated(server, (page - 1) * pageSize, page * pageSize)).thenReturn(experiences);
|
||||
LeaderBoard leaderBoardData = testUnit.findLeaderBoardData(server, page);
|
||||
page--;
|
||||
List<LeaderBoardEntry> entries = leaderBoardData.getEntries();
|
||||
|
||||
@@ -87,10 +87,10 @@ public class UserExperienceManagementServiceBeanTest extends ExperienceRelatedTe
|
||||
int startIndex = 11;
|
||||
List<AUserExperience> userExperiences = getUserExperiences();
|
||||
when(repository.findTop10ByUser_ServerReferenceOrderByExperienceDesc(server, PageRequest.of(startIndex, endIndex))).thenReturn(userExperiences);
|
||||
List<AUserExperience> leaderboardUsersPaginated = testUnit.findLeaderboardUsersPaginated(server, startIndex, endIndex);
|
||||
Assert.assertEquals(userExperiences.size(), leaderboardUsersPaginated.size());
|
||||
List<AUserExperience> leaderBoardUsersPaginated = testUnit.findLeaderBoardUsersPaginated(server, startIndex, endIndex);
|
||||
Assert.assertEquals(userExperiences.size(), leaderBoardUsersPaginated.size());
|
||||
for (int i = 0; i < userExperiences.size(); i++) {
|
||||
Assert.assertEquals(userExperiences.get(i).getExperience(), leaderboardUsersPaginated.get(i).getExperience());
|
||||
Assert.assertEquals(userExperiences.get(i).getExperience(), leaderBoardUsersPaginated.get(i).getExperience());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ package dev.sheldan.abstracto.experience.config.features;
|
||||
import dev.sheldan.abstracto.core.config.FeatureEnum;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* The experience tracking feature enum, this is used to switch off/on experience tracking.
|
||||
*/
|
||||
@Getter
|
||||
public enum ExperienceFeature implements FeatureEnum {
|
||||
EXPERIENCE("experience");
|
||||
|
||||
@@ -7,11 +7,24 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* {@link FeatureConfig} instance containing the required configuration concerning system config and post targets for
|
||||
* the {@link ExperienceFeature} feature.
|
||||
*/
|
||||
@Component
|
||||
public class ExperienceFeatureConfig implements FeatureConfig {
|
||||
|
||||
/**
|
||||
* Minimum experience a user can earn per tracked message
|
||||
*/
|
||||
public static final String MIN_EXP_KEY = "minExp";
|
||||
/**
|
||||
* Maximum experience a user can earn per tracked message
|
||||
*/
|
||||
public static final String MAX_EXP_KEY = "maxExp";
|
||||
/**
|
||||
* The multiplier which is applied to each calculated gained experience
|
||||
*/
|
||||
public static final String EXP_MULTIPLIER_KEY = "expMultiplier";
|
||||
|
||||
@Override
|
||||
@@ -19,6 +32,9 @@ public class ExperienceFeatureConfig implements FeatureConfig {
|
||||
return ExperienceFeature.EXPERIENCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* All of the configuration keys are required in order for this feature to function
|
||||
*/
|
||||
@Override
|
||||
public List<String> getRequiredSystemConfigKeys() {
|
||||
return Arrays.asList(EXP_MULTIPLIER_KEY, MIN_EXP_KEY, MAX_EXP_KEY);
|
||||
|
||||
@@ -6,6 +6,9 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* A role for which the experience gain in a particular server has been disabled.
|
||||
*/
|
||||
@Builder
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
|
||||
@@ -10,6 +10,9 @@ import lombok.experimental.SuperBuilder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Model used to render an overview of the roles for which experience gain has been disabled on the current server.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@SuperBuilder
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.Setter;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
|
||||
/**
|
||||
* Model used in the list of members when rendering the leaderboard command. The reason this is necessary,
|
||||
* Model used in the list of members when rendering the leaderboard template. The reason this is necessary,
|
||||
* is because we need more than just the {@link AUserExperience} object, we also need the position of the user in this
|
||||
* guild and the {@link Member} for convenience in the templates.
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,7 @@ import lombok.Setter;
|
||||
|
||||
/**
|
||||
* Object containing the status update information when the user executes the
|
||||
* command responsible for synchronizing the users with their experience roles. This is a very barebones
|
||||
* command responsible for synchronizing the users with their experience roles. This is a very small
|
||||
* object as it only contains the current count and the total amount.
|
||||
*/
|
||||
@Getter
|
||||
|
||||
@@ -44,7 +44,7 @@ public interface AUserExperienceService {
|
||||
AExperienceLevel calculateLevel(AUserExperience experience, List<AExperienceLevel> levels);
|
||||
|
||||
/**
|
||||
* Increases the experience of the provided {@link AUserExperience} object and and calculates the new level according
|
||||
* Calculates the new level of the provided {@link AUserExperience} according
|
||||
* to the provided list of {@link AExperienceLevel} used as level configuration
|
||||
* @param userExperience The {@link AUserExperience} to increase the experience for
|
||||
* @param levels The list of {@link AExperienceLevel} to be used as level configuration
|
||||
@@ -127,6 +127,15 @@ public interface AUserExperienceService {
|
||||
*/
|
||||
void executeActionOnUserExperiencesWithFeedBack(List<AUserExperience> experiences, AChannel channel, Consumer<AUserExperience> toExecute);
|
||||
|
||||
/**
|
||||
* Disables the experience gain for a user directly. This sets the `experienceGainDisabled` on the respective {@link AUserExperience} object to true
|
||||
* @param userInAServer The {@link AUserInAServer} to disable experience gain for
|
||||
*/
|
||||
void disableExperienceForUser(AUserInAServer userInAServer);
|
||||
|
||||
/**
|
||||
* Enables the experience gain for a user directly. This sets the `experienceGainDisabled` on the respective {@link AUserExperience} object to false
|
||||
* @param userInAServer The {@link AUserInAServer} to enable experience for
|
||||
*/
|
||||
void enableExperienceForUser(AUserInAServer userInAServer);
|
||||
}
|
||||
|
||||
@@ -36,5 +36,13 @@ public interface ExperienceRoleService {
|
||||
*/
|
||||
AExperienceRole calculateRole(AUserExperience userExperience, List<AExperienceRole> roles);
|
||||
|
||||
/**
|
||||
* Calculates the level at which the next role for a given level is available.
|
||||
* For example, if the given {@link AExperienceLevel} is 5, and a a {@link AExperienceRole} is awarded at 8, but none in between, this method will return
|
||||
* the {@link AExperienceLevel} 8.
|
||||
* @param startLevel The {@link AExperienceLevel} to start off at
|
||||
* @param server The {@link AServer} to use for the {@link AExperienceRole} configuration
|
||||
* @return The next {@link AExperienceLevel} a {@link AExperienceRole} is awarded at, this will be null if there are no roles or there is no further role to reach
|
||||
*/
|
||||
AExperienceLevel getLevelOfNextRole(AExperienceLevel startLevel, AServer server);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,37 @@ import dev.sheldan.abstracto.experience.models.database.ADisabledExpRole;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service used to manage the instances of {@link ADisabledExpRole} in the database, which includes creating, removing and retrieving them
|
||||
*/
|
||||
public interface DisabledExpRoleManagementService {
|
||||
|
||||
/**
|
||||
* Creates an instance of {@link ADisabledExpRole} which marks the {@link ARole} as disabled. This effectively means, that the experience is disabled for members
|
||||
* which have the {@link ARole}
|
||||
* @param role The {@link ARole} which should be used as a role to disable experience
|
||||
* @return The create instance of {@link ADisabledExpRole}
|
||||
*/
|
||||
ADisabledExpRole setRoleToBeDisabledForExp(ARole role);
|
||||
|
||||
/**
|
||||
* Removes the given {@link ARole} from the list of roles which had their experience gain disabled. This method removes the instance from the list of
|
||||
* {@link ADisabledExpRole} and enables experience for the given {@link ARole}
|
||||
* @param role The {@link ARole} to enable experience for
|
||||
*/
|
||||
void removeRoleToBeDisabledForExp(ARole role);
|
||||
|
||||
/**
|
||||
* Retrieves all the {@link ADisabledExpRole} roles for a given {@link AServer}, which means, it returns all roles for which there is
|
||||
* @param server The {@link AServer} to retrieve all {@link ADisabledExpRole} for
|
||||
* @return A List of {@link ADisabledExpRole} which are currently on the {@link AServer}
|
||||
*/
|
||||
List<ADisabledExpRole> getDisabledRolesForServer(AServer server);
|
||||
|
||||
/**
|
||||
* Checks if the given {@link ARole} has its experience disabled and returns true if so
|
||||
* @param role The {@link ARole} to check for
|
||||
* @return Whether or not the given {@link ARole} has the experience disabled.
|
||||
*/
|
||||
boolean isExperienceDisabledForRole(ARole role);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public interface UserExperienceManagementService {
|
||||
* @param end The end index for which to return a sublist of {@link AUserExperience} elements for
|
||||
* @return A list desc ordered by {@link AUserExperience.experience} only containing the elements between {@code start} and @{code end}
|
||||
*/
|
||||
List<AUserExperience> findLeaderboardUsersPaginated(AServer server, Integer start, Integer end);
|
||||
List<AUserExperience> findLeaderBoardUsersPaginated(AServer server, Integer start, Integer end);
|
||||
|
||||
/**
|
||||
* Returns the {@link LeaderBoardEntryResult} of the given {@link AUserExperience}.
|
||||
|
||||
Reference in New Issue
Block a user