mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-20 05:24:09 +00:00
update JDA and jda Utilities version
fixed typos in the code
This commit is contained in:
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class LeaderBoardCommand extends AbstractConditionableCommand {
|
||||
|
||||
public static final String LEADERBOARD_POST_EMBED_TEMPLATE = "leaderboard_post";
|
||||
public static final String LEADER_BOARD_POST_EMBED_TEMPLATE = "leaderboard_post";
|
||||
@Autowired
|
||||
private AUserExperienceService userExperienceService;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class LeaderBoardCommand extends AbstractConditionableCommand {
|
||||
|
||||
LeaderBoardEntry userRank = userExperienceService.getRankOfUserInServer(commandContext.getUserInitiatedContext().getAUserInAServer());
|
||||
leaderBoardModel.setUserExecuting(converter.fromLeaderBoardEntry(userRank));
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(LEADERBOARD_POST_EMBED_TEMPLATE, leaderBoardModel);
|
||||
MessageToSend messageToSend = templateService.renderEmbedTemplate(LEADER_BOARD_POST_EMBED_TEMPLATE, leaderBoardModel);
|
||||
channelService.sendMessageToSendToChannel(messageToSend, commandContext.getChannel());
|
||||
|
||||
return CommandResult.fromSuccess();
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface UserExperienceRepository extends JpaRepository<AUserExperience
|
||||
|
||||
/**
|
||||
* Finds all {@link AUserExperience} of the given {@link AServer}
|
||||
* @param server The {@link AServer} to retriev ethe {@link AUserExperience} for
|
||||
* @param server The {@link AServer} to retrieve ethe {@link AUserExperience} for
|
||||
* @return A complete list of {@link AUserExperience} of the given {@link AServer}
|
||||
*/
|
||||
@QueryHints(@QueryHint(name = org.hibernate.annotations.QueryHints.CACHEABLE, value = "true"))
|
||||
@@ -30,7 +30,7 @@ public interface UserExperienceRepository extends JpaRepository<AUserExperience
|
||||
/**
|
||||
* Retrieves the {@link AUserExperience} ordered by experience, and applies the {@link Pageable} to only filter out certain pages.
|
||||
* @param server The {@link AServer} to retrieve the {@link AUserExperience} information for
|
||||
* @param pageable A {@link Pageable} object to indicate the pages which should be retrieved, pagesize is 10
|
||||
* @param pageable A {@link Pageable} object to indicate the pages which should be retrieved, page size is 10
|
||||
* @return A list of {@link AUserExperience} of the given {@link AServer} ordered by the experience of the users, paginated by the given
|
||||
* configuration
|
||||
*/
|
||||
|
||||
@@ -302,10 +302,10 @@ public class AUserExperienceServiceBean implements AUserExperienceService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the leaderboard data for the given page of the given server
|
||||
* @param server The {@link AServer} to retrieve the leaderboard for
|
||||
* @param page The desired page on the leaderboard. The pagesize is 10
|
||||
* @return The {@link LeaderBoard} containing all necessary information concerning the leaderboard
|
||||
* Retrieves the leader board data for the given page of the given server
|
||||
* @param server The {@link AServer} to retrieve the leader board for
|
||||
* @param page The desired page on the leader board. The page size is 10
|
||||
* @return The {@link LeaderBoard} containing all necessary information concerning the leader board
|
||||
*/
|
||||
@Override
|
||||
public LeaderBoard findLeaderBoardData(AServer server, Integer page) {
|
||||
@@ -326,7 +326,7 @@ public class AUserExperienceServiceBean implements AUserExperienceService {
|
||||
/**
|
||||
* Builds an {@link AUserExperience} and loads the appropriate rank of the passed {@link AUserInAServer}
|
||||
* @param userInAServer The {@link AUserInAServer} to retrieve the {@link LeaderBoardEntry} for
|
||||
* @return The {@link LeaderBoardEntry} representing one single row in the leaderboard
|
||||
* @return The {@link LeaderBoardEntry} representing one single row in the leader board
|
||||
*/
|
||||
@Override
|
||||
public LeaderBoardEntry getRankOfUserInServer(AUserInAServer userInAServer) {
|
||||
|
||||
@@ -30,10 +30,10 @@ public class ExperienceRoleServiceBean implements ExperienceRoleService {
|
||||
private AUserExperienceService userExperienceService;
|
||||
|
||||
/**
|
||||
* Unsets the current configuration for the passed level, and sets the {@link ARole} to be used for this level
|
||||
* UnSets the current configuration for the passed level, and sets the {@link ARole} to be used for this level
|
||||
* in the given {@link AServer}
|
||||
* @param role The {@link ARole} to set the level to
|
||||
* @param level The level the {@link ARole} should be awareded at
|
||||
* @param level The level the {@link ARole} should be awarded at
|
||||
*/
|
||||
@Override
|
||||
public void setRoleToLevel(ARole role, Integer level, AChannel feedbackChannel) {
|
||||
|
||||
@@ -58,7 +58,7 @@ public class UserExperienceManagementServiceBean implements UserExperienceManage
|
||||
* Creates or updates the {@link AUserExperience} object. Does not change the level or the role.
|
||||
* @param user The {@link AUserInAServer} to increase the experience for
|
||||
* @param experience The experience amount to increase by
|
||||
* @param messageCount The amount of messags to increase the count by
|
||||
* @param messageCount The amount of messages to increase the count by
|
||||
* @return The created/changed {@link AUserExperience} object
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -67,7 +67,7 @@ public class LeaderBoardCommandTest {
|
||||
LeaderBoardEntryModel leaderBoardEntryModel = LeaderBoardEntryModel.builder().build();
|
||||
when(converter.fromLeaderBoardEntry(executingUserRank)).thenReturn(leaderBoardEntryModel);
|
||||
MessageToSend messageToSend = MessageToSend.builder().build();
|
||||
when(templateService.renderEmbedTemplate(eq(LeaderBoardCommand.LEADERBOARD_POST_EMBED_TEMPLATE), any(LeaderBoardModel.class))).thenReturn(messageToSend);
|
||||
when(templateService.renderEmbedTemplate(eq(LeaderBoardCommand.LEADER_BOARD_POST_EMBED_TEMPLATE), any(LeaderBoardModel.class))).thenReturn(messageToSend);
|
||||
CommandResult result = testUnit.execute(context);
|
||||
verify(channelService, times(1)).sendMessageToSendToChannel(messageToSend, context.getChannel());
|
||||
CommandTestUtilities.checkSuccessfulCompletion(result);
|
||||
|
||||
@@ -7,14 +7,14 @@ import lombok.Setter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Wrapper object containing a list of {@link LeaderBoardEntry} representing a leaderboard.
|
||||
* Wrapper object containing a list of {@link LeaderBoardEntry} representing a leader board.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
public class LeaderBoard {
|
||||
/**
|
||||
* List of {@link LeaderBoardEntry} representing the leaderboard.
|
||||
* List of {@link LeaderBoardEntry} representing the leader board.
|
||||
*/
|
||||
private List<LeaderBoardEntry> entries;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public interface LeaderBoardEntryResult {
|
||||
Long getMessageCount();
|
||||
|
||||
/**
|
||||
* The current position of the {@link dev.sheldan.abstracto.core.models.database.AUserInAServer} in the leaderboard
|
||||
* The current position of the {@link dev.sheldan.abstracto.core.models.database.AUserInAServer} in the leader board
|
||||
* ordered by experience count
|
||||
*/
|
||||
Integer getRank();
|
||||
|
||||
@@ -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 template. The reason this is necessary,
|
||||
* Model used in the list of members when rendering the leader board 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.
|
||||
*/
|
||||
|
||||
@@ -8,8 +8,8 @@ import lombok.experimental.SuperBuilder;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Object containing the complete information passed to the leaderboard template. It contains the leaderboard
|
||||
* information of the requested page of the total users and the leaderboard information of the user executing the
|
||||
* Object containing the complete information passed to the leader board template. It contains the leader board
|
||||
* information of the requested page of the total users and the leader board information of the user executing the
|
||||
* command.
|
||||
*/
|
||||
@Getter
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface ExperienceRoleService {
|
||||
* Calculates the appropriate {@link AExperienceRole} based on the provided list of {@link AExperienceRole}
|
||||
* @param userExperience The {@link AUserExperience} containing the level to calculate the {@link AExperienceRole}
|
||||
* @param roles The role configuration to be used when calculating the appropriate {@link AExperienceRole}
|
||||
* @return The best matching {@link AExperienceRole} accordign to the experience in the provided {@link AUserExperience}
|
||||
* @return The best matching {@link AExperienceRole} according to the experience in the provided {@link AUserExperience}
|
||||
*/
|
||||
AExperienceRole calculateRole(AUserExperience userExperience, List<AExperienceRole> roles);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.Optional;
|
||||
public interface ExperienceLevelManagementService {
|
||||
/**
|
||||
* Creates the level referenced by the level and the needed experience in the database.
|
||||
* @param level The unique level this level should reprsent.
|
||||
* @param level The unique level this level should represent.
|
||||
* @param neededExperience The total amount of experience required to reach this level.
|
||||
* @return A newly created {@link AExperienceLevel} instance.
|
||||
*/
|
||||
|
||||
@@ -44,7 +44,7 @@ public interface ExperienceRoleManagementService {
|
||||
AExperienceRole getRoleInServer(ARole role);
|
||||
|
||||
/**
|
||||
* Retrives all {@link AExperienceRole} configured in the given {@link AServer}
|
||||
* Retrieves all {@link AExperienceRole} configured in the given {@link AServer}
|
||||
* @param server The server to retrieve the list of {@link AExperienceRole} for
|
||||
* @return A list of {@link AExperienceRole} which are currently configured for the {@link AServer}
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,7 @@ public interface UserExperienceManagementService {
|
||||
* are not changed.
|
||||
* @param user The {@link AUserInAServer} to increase the experience for
|
||||
* @param experience The experience amount to increase by
|
||||
* @param messageCount The amount of messags to increase the count by
|
||||
* @param messageCount The amount of messages to increase the count by
|
||||
* @return The changed/creates {@link AUserExperience} object containing the values.
|
||||
*/
|
||||
AUserExperience incrementExpForUser(AUserInAServer user, Long experience, Long messageCount);
|
||||
|
||||
Reference in New Issue
Block a user