Skip to content

Commit

Permalink
[code-style] Adicionado parâmetro para sinalizar o uso.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristian-Sknz committed Jan 31, 2021
1 parent 7121013 commit d895a2c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/java/me/skiincraft/api/osu/entity/other/Option.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package me.skiincraft.api.osu.entity.other;

public interface Option {
public interface Option<T> {

default String toQueueParameter() {
return null;
}
Class<T> getOptionType();
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package me.skiincraft.api.osu.object.beatmap;

import me.skiincraft.api.osu.entity.beatmap.BeatmapSet;
import me.skiincraft.api.osu.entity.other.Option;
import me.skiincraft.api.osu.object.game.GameMode;

public class SearchOption implements Option {
public class SearchOption implements Option<BeatmapSet> {

private GameMode gameMode = GameMode.Osu;
private Approval category = Approval.ANY;
Expand Down Expand Up @@ -111,6 +112,11 @@ public String toString() {
'}';
}

@Override
public Class<BeatmapSet> getOptionType() {
return BeatmapSet.class;
}

public enum SearchSort {

TITLE, ARTIST, DIFFICULT, RANKED, RATING, PLAYS, FAVOURITES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package me.skiincraft.api.osu.object.ranking;

import me.skiincraft.api.osu.entity.other.Option;
import me.skiincraft.api.osu.entity.ranking.Ranking;
import me.skiincraft.api.osu.object.game.GameMode;

public class RankingOption implements Option {
public class RankingOption implements Option<Ranking> {

private final RankingType type;
private GameMode gamemode;
Expand Down Expand Up @@ -67,6 +68,11 @@ public String toQueueParameter() {
: (type == RankingType.Charts && spotlight != -1) ? "&spotlight=" + spotlight : ""));
}

@Override
public Class<Ranking> getOptionType() {
return Ranking.class;
}

public int getCursor() {
return cursor;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package me.skiincraft.api.osu.object.score;

import me.skiincraft.api.osu.entity.other.Option;
import me.skiincraft.api.osu.entity.score.Score;
import me.skiincraft.api.osu.object.game.GameMode;

public class ScoreOption implements Option {
public class ScoreOption implements Option<Score> {

private ScoreType type;
private GameMode gameMode;
Expand Down Expand Up @@ -83,6 +84,11 @@ public String toQueueParameter() {
((offset != 0) ? "&offset=" + offset : "");
}

@Override
public Class<Score> getOptionType() {
return Score.class;
}

public String toV1QueueParameter() {
return "limit=" + limit + ((gameMode != null) ? "&mode=" + gameMode.getId() : "");
}
Expand Down

0 comments on commit d895a2c

Please sign in to comment.