package de.craften.plugins.minigamemanager.plugin.scoreboards.topics;

/**
 * Some static topics.
 *
 * @see Topic
 */
public final class Topics {
    private static final Topic EMPTY = score -> "";
    private static final Topic PLAYER_NAME = score -> score.getPlayer().getName();
    private static final Topic SCORE = score -> String.valueOf(score.getScore());
    private static final Topic TIME = score -> "n/a"; //TODO implement

    private static final Topic RANK = score -> String.valueOf(score.getRank());
    private static final Topic ORDINAL_RANK = score -> "n/a"; //TODO implement

    private Topics() {
    }

    public static Topic fromString(String str) {
        switch (str) {
            case "player.name":
                return PLAYER_NAME;
            case "score":
                return SCORE;
            case "rank":
                return RANK;
            case "rank.ordinal":
                return ORDINAL_RANK;
            case "time":
                return TIME;
            default:
                return EMPTY;
        }
    }
}

@@ -564,39 +564,373 @@
 core -%3E 
-%22n/a%22; //TODO implement
+%7B%0A        int rank = score.getRank();%0A        String%5B%5D suffixes = new String%5B%5D%7B%22th%22, %22st%22, %22nd%22, %22rd%22, %22th%22, %22th%22, %22th%22, %22th%22, %22th%22, %22th%22%7D;%0A        switch (rank %25 100) %7B%0A            case 11:%0A            case 12:%0A            case 13:%0A                return rank + %22th%22;%0A            default:%0A                return rank + suffixes%5Brank %25 10%5D;%0A        %7D%0A    %7D;
 %0A%0A    pr

Implement ordinal rank topic.