Search in sources :

Example 6 with ScCategory

use of com.faendir.zachtronics.bot.sc.model.ScCategory in project zachtronics-leaderboard-bot by F43nd1r.

the class ScShowCommand method findPuzzleAndCategory.

@NotNull
@Override
public Pair<ScPuzzle, ScCategory> findPuzzleAndCategory(@NotNull ShowData parameters) {
    ScPuzzle puzzle = parameters.puzzle;
    ScCategory category = parameters.category;
    if (!parameters.puzzle.getSupportedCategories().contains(category))
        throw new IllegalArgumentException("Category " + category.getDisplayName() + " does not support " + puzzle.getDisplayName());
    return new Pair<>(puzzle, category);
}
Also used : ScPuzzle(com.faendir.zachtronics.bot.sc.model.ScPuzzle) ScCategory(com.faendir.zachtronics.bot.sc.model.ScCategory) Pair(kotlin.Pair) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ScCategory (com.faendir.zachtronics.bot.sc.model.ScCategory)6 NotNull (org.jetbrains.annotations.NotNull)5 CategoryRecord (com.faendir.zachtronics.bot.repository.CategoryRecord)3 SubmitResult (com.faendir.zachtronics.bot.repository.SubmitResult)2 ScPuzzle (com.faendir.zachtronics.bot.sc.model.ScPuzzle)2 IOException (java.io.IOException)2 Path (java.nio.file.Path)2 BotTest (com.faendir.zachtronics.bot.BotTest)1 GitRepository (com.faendir.zachtronics.bot.git.GitRepository)1 DisplayContext (com.faendir.zachtronics.bot.model.DisplayContext)1 StringFormat (com.faendir.zachtronics.bot.model.StringFormat)1 RedditService (com.faendir.zachtronics.bot.reddit.RedditService)1 Subreddit (com.faendir.zachtronics.bot.reddit.Subreddit)1 AbstractSolutionRepository (com.faendir.zachtronics.bot.repository.AbstractSolutionRepository)1 com.faendir.zachtronics.bot.sc.model (com.faendir.zachtronics.bot.sc.model)1 ScRecord (com.faendir.zachtronics.bot.sc.model.ScRecord)1 ScScore (com.faendir.zachtronics.bot.sc.model.ScScore)1 Markdown (com.faendir.zachtronics.bot.utils.Markdown)1 ValidationResult (com.faendir.zachtronics.bot.validation.ValidationResult)1 Files (java.nio.file.Files)1