# Trivia

## Highlights

* Questions and Answers are display through Pixelmon dialogues.
* Point base rewards, encouraging competitiveness to get the best rewards.
* Trivia result are display through user interface where players can see their points, each other's answers, and points leaderboard as well.

## Commands

| /trivia                 | N/A                   | Opens the user interface displaying the trivia results. |
| ----------------------- | --------------------- | ------------------------------------------------------- |
| /trivia info            | N/A                   | Shows the plugin information and commands.              |
| /trivia reload          | trivia.command.reload | Reloads the configuration files.                        |
| /trivia join            | trivia.command.join   | Joins the trivia.                                       |
| /trivia leave           | trivia.command.leave  | Leaves the trivia.                                      |
| /trivia stop            | trivia.command.stop   | Stops the trivia.                                       |
| /trivia start \<trivia> | trivia.command.start  | Starts the trivia.                                      |

## Main Configuration

<details>

<summary>Expand</summary>

```json
{
  "CommandAlias": [
    "trivia",
    "kahoot"
  ],
  # The time in seconds before actually starting the trivia.
  "WaitDuration": 60,
  "Trivia": {
    "Trivia1": {
      "ShuffleQuestionnaires": true,
      "Questionnaires": [
        {
          # The points the player will get for correctly answering this question.
          "Points": 1,
          # The time in seconds before proceeding to the next question.
          "Duration": 10,
          "Question": "What was the first legendary pokemon ash saw?",
          "Answers": [
            "Ho-Oh"
          ],
          "Choices": [
            "Entei",
            "Celebi",
            "Ho-Oh",
            "Mewtwo",
            "Magikarp"
          ]
        },
        {
          "Points": 1,
          "Duration": 10,
          "Question": "How many plates does arceus have?",
          "Answers": [
            "19"
          ],
          "Choices": [
            "19",
            "20",
            "16"
          ]
        }
      ],
      "Rewards": {
        # The required points needed to get these rewards.
        "1": [
          "give %player% minecraft:dirt 1",
          "tell %player% You received 1x Dirt!"
        ],
        "2": [
          "give %player% minecraft:diamond 1",
          "tell %player% You received 1x Diamond!"
        ]
      }
    },
    "Trivia2": {
      "ShuffleQuestionnaires": true,
      "Questionnaires": [
        {
          "Points": 2,
          "Duration": 15,
          "Question": "Which Pokémon is known for having the signature move “Spacial Rend”? (2 Points)",
          "Answers": [
            "palkia"
          ],
          "Choices": []
        },
        {
          "Points": 1,
          "Duration": 10,
          "Question": "Galarian Stunfisk is exclusively a Steel Type?",
          "Answers": [
            "False"
          ],
          "Choices": [
            "True",
            "False"
          ]
        }
      ],
      "Rewards": {
        "1": [
          "give %player% minecraft:dirt 1",
          "tell %player% You received 1x Dirt!"
        ],
        "2": [
          "give %player% minecraft:diamond 1",
          "tell %player% You received 1x Diamond!"
        ]
      }
    }
  }
}
```

</details>

## User Interface Configuration

<details>

<summary>Expand</summary>

```json
{
  "DialogueSpeakerPokemon": "pikachu",
  "DialogueSpeakerPlayerUUID": "",
  "DialogueSpeakerName": "Professor Pikachu",
  "QuestionnaireDisplayItem": "minecraft:paper",
  "QuestionnaireDisplayName": "&6%question%",
  "QuestionnaireDisplayNbt": [],
  "UserInterfaceRows": 5,
  "UserInterfaceTitle": "&#404040Trivia Results",
  "UserInterface": {
    "0": {
      "DisplayItem": "minecraft:red_stained_glass_pane"
    },
    "1": {
      "DisplayItem": "minecraft:red_stained_glass_pane"
    },
    "2": {
      "DisplayItem": "minecraft:red_stained_glass_pane"
    },
    "3": {
      "Type": "player_points",
      "DisplayItem": "minecraft:book",
      "DisplayName": "&6Your points: &b%points%"
    },
    "4": {
      "DisplayItem": "minecraft:red_stained_glass_pane"
    },
    "5": {
      "Type": "leaderboard",
      "DisplayItem": "minecraft:ladder",
      "DisplayName": "&6Leaderboard",
      "DisplayLore": [
        "&bTop 10 Player Points",
        "&71.&e%player_1% &7- &a%points_1% Points",
        "&72.&e%player_2% &7- &a%points_2% Points",
        "&73.&e%player_3% &7- &a%points_3% Points",
        "&74.&e%player_4% &7- &a%points_4% Points",
        "&75.&e%player_5% &7- &a%points_5% Points",
        "&76.&e%player_6% &7- &a%points_6% Points",
        "&77.&e%player_7% &7- &a%points_7% Points",
        "&78.&e%player_8% &7- &a%points_8% Points",
        "&79.&e%player_9% &7- &a%points_9% Points",
        "&710.&e%player_10% &7- &a%points_10% Points"
      ]
    },
    "6": {
      "DisplayItem": "minecraft:red_stained_glass_pane"
    },
    "7": {
      "DisplayItem": "minecraft:red_stained_glass_pane"
    },
    "8": {
      "DisplayItem": "minecraft:red_stained_glass_pane"
    },
    "9": {
      "DisplayItem": "minecraft:red_stained_glass_pane"
    },
    "17": {
      "DisplayItem": "minecraft:red_stained_glass_pane"
    },
    "18": {
      "DisplayItem": "minecraft:black_stained_glass_pane"
    },
    "26": {
      "DisplayItem": "minecraft:black_stained_glass_pane"
    },
    "27": {
      "DisplayItem": "minecraft:white_stained_glass_pane"
    },
    "35": {
      "DisplayItem": "minecraft:white_stained_glass_pane"
    },
    "36": {
      "DisplayItem": "minecraft:white_stained_glass_pane"
    },
    "37": {
      "DisplayItem": "minecraft:white_stained_glass_pane"
    },
    "38": {
      "DisplayItem": "minecraft:white_stained_glass_pane"
    },
    "39": {
      "Type": "previous",
      "DisplayItem": "minecraft:spectral_arrow",
      "DisplayName": "&6Previous"
    },
    "40": {
      "DisplayItem": "minecraft:white_stained_glass_pane"
    },
    "41": {
      "Type": "next",
      "DisplayItem": "minecraft:spectral_arrow",
      "DisplayName": "&6Next"
    },
    "42": {
      "DisplayItem": "minecraft:white_stained_glass_pane"
    },
    "43": {
      "DisplayItem": "minecraft:white_stained_glass_pane"
    },
    "44": {
      "DisplayItem": "minecraft:white_stained_glass_pane"
    }
  }
}
```

</details>

## Messages Configuration

<details>

<summary>Expand</summary>

```json
{
  "WaitMessage": "&aTrivia is now accepting participants, join using /trivia join.",
  "StartMessage": "&aTrivia has started, read the questions carefully then answer wisely.",
  "EndMessage": "&aTrivia has ended, view the results using /trivia.",
  "NotAcceptingParticipant": "&cThe trivia is not accepting participants at the moment!",
  "AlreadyParticipant": "&cYou are already a participant!",
  "JoinMessage": "&aYou are now a participant.",
  "NotParticipant": "&cYou are not a participant!",
  "LeaveMessage": "&aYou are no longer a participant.",
  "BossBarWaitColor": "yellow",
  "BossBarWaitText": "&eTrivia will start in %HH% hours %MM% minutes %SS% seconds, join using /trivia join",
  "BossBarQuestionnaireColor": "green",
  "BossBarQuestionnaireText": "&aNext question will start in %SS% seconds!",
  "BossBarEndingColor": "red",
  "BossBarEndingText": "&cTrivia will end in %SS% seconds!",
  "CorrectAnswerText": " &a(Correct Answer)",
  "AnswerText": "&7- &b%answer%",
  "PlayerText": "&e%player%",
  "NoData": "&7???"
}
```

</details>

## Dependencies

* Java 21
* [GooeyLibs Fabric 1.21.1](https://modrinth.com/mod/gooeylibs)
* [Cobblemon Fabric 1.21.1](https://modrinth.com/mod/cobblemon/)

## Example

{% embed url="<https://youtu.be/fE-6APiYnuw>" %}
