Chat Games Configuration

The chatgames.yml file controls PrimeChat's interactive trivia system, including questions, answers, rewards, timing, and display messages.

File Location

plugins/PrimeChat/chatgames.yml

Core Settings

Game System Configuration

settings:
  # Enable/disable chat games feature
  enabled: true
  
  # Interval between automatic questions (in minutes)
  interval: 5
  
  # Timeout for each question (in seconds)
  timeout: 60
  
  # Enable/disable sending questions automatically
  auto-send: true

Settings Breakdown

  • enabled: Master switch for the entire chat games system

  • interval: How often automatic games are sent (converted to ticks: interval * 60 * 20)

  • timeout: How long players have to answer before the game expires

  • auto-send: Whether games are sent automatically or only manually via commands

Game Messages Configuration

Question Announcement

messages:
  question-announcement:
    - ""
    - "&#FF6347&l⚡ CHAT GAME ⚡"
    - "&#32CD32Answer the question below to win a reward!"
    - ""

Question Display Format

messages:
  question-format:
    - "&#FF6347&l❓ QUESTION: &#E0E0E0%question%"
    - ""
    - "&#FFC447&l💡 HINT: &#888888Type your answer in chat to participate!"

Available Placeholders: %question%

Winner Announcements

messages:
  winner-announcement:
    - ""
    - "&#32CD32&l🎉 WINNER! 🎉"
    - "&#E0E0E0%player% &#32CD32answered correctly in &#FFD700%time%&#32CD32!"
    - ""

Available Placeholders: %player%, %time%

Individual Messages

messages:
  # Personal congratulations to winner
  correct-answer: "&#32CD32✔ Congratulations! You answered in &#FFD700%time%&#32CD32 and won: &#E0E0E0%reward%"
  
  # Timeout message when no one answers
  timeout-message: "&#4D4D4D&l| &#FF6347&lTIME UP &#4D4D4D&l» &r&#FFC447No one answered the question in time! The answer was: &#E0E0E0%answer%"
  
  # Command feedback messages
  no-permission: "&#FF4747✖ You don't have permission to use this command."
  question-sent: "&#32CD32✔ Chat game question sent successfully!"
  games-disabled: "&#FFC447⚠ Chat games are currently disabled."
  already-active: "&#FFC447⚠ A chat game is already active. Please wait for it to finish."

Available Placeholders: %time%, %reward%, %answer%

Question Database

Question Structure

Each question follows this format:

games:
  question-id:
    question: "Your question text here?"
    answers:
      - "correct answer 1"
      - "correct answer 2"
      - "case variation"
    reward-command: "console command to execute"
    reward-display: "description shown to players"

Example Questions

Trivia Questions

games:
  trivia-1:
    question: "What is the capital of France?"
    answers:
      - "Paris"
      - "paris"
    reward-command: "give %player% diamond 1"
    reward-display: "1x Diamond"
    
  trivia-2:
    question: "What is 2 + 2?"
    answers:
      - "4"
      - "four"
      - "Four"
    reward-command: "give %player% gold_ingot 5"
    reward-display: "5x Gold Ingot"
    
  trivia-3:
    question: "What is the largest ocean on Earth?"
    answers:
      - "Pacific"
      - "pacific"
      - "Pacific Ocean"
      - "pacific ocean"
    reward-command: "give %player% emerald 3"
    reward-display: "3x Emerald"

Minecraft-Specific Questions

games:
  minecraft-1:
    question: "In Minecraft, what do you need to make a cake?"
    answers:
      - "milk wheat sugar egg"
      - "wheat milk sugar egg"
      - "3 milk 3 wheat 2 sugar 1 egg"
      - "milk, wheat, sugar, egg"
    reward-command: "give %player% cake 1"
    reward-display: "1x Cake"
    
  minecraft-2:
    question: "What year was Minecraft released?"
    answers:
      - "2011"
      - "2009"
    reward-command: "eco give %player% 1000"
    reward-display: "$1000"
    
  minecraft-3:
    question: "What ore is used to make netherite?"
    answers:
      - "ancient debris"
      - "Ancient Debris"
      - "netherite scrap"
      - "Netherite Scrap"
    reward-command: "give %player% netherite_scrap 1"
    reward-display: "1x Netherite Scrap"

Mathematical Questions

games:
  math-1:
    question: "What is 15 × 4?"
    answers:
      - "60"
      - "sixty"
    reward-command: "give %player% iron_ingot 10"
    reward-display: "10x Iron Ingot"
    
  math-2:
    question: "What is the square root of 64?"
    answers:
      - "8"
      - "eight"
    reward-command: "give %player% redstone 32"
    reward-display: "32x Redstone"

Geography Questions

games:
  geography-1:
    question: "What is the smallest country in the world?"
    answers:
      - "Vatican City"
      - "vatican city"
      - "Vatican"
      - "vatican"
    reward-command: "give %player% book 5"
    reward-display: "5x Book"
    
  geography-2:
    question: "Which country has the most time zones?"
    answers:
      - "France"
      - "france"
    reward-command: "give %player% clock 1"
    reward-display: "1x Clock"

Science Questions

games:
  science-1:
    question: "What is the chemical symbol for gold?"
    answers:
      - "Au"
      - "au"
      - "AU"
    reward-command: "give %player% gold_block 1"
    reward-display: "1x Gold Block"
    
  science-2:
    question: "How many bones are in the human body?"
    answers:
      - "206"
      - "two hundred six"
    reward-command: "give %player% bone 10"
    reward-display: "10x Bone"

Word Games

games:
  random-1:
    question: "Unscramble: TREAC"
    answers:
      - "trace"
      - "Trace"
      - "crate"
      - "Crate"
      - "react"
      - "React"
    reward-command: "give %player% chest 1"
    reward-display: "1x Chest"

Reward System

Command-Based Rewards

The reward-command field executes console commands when a player wins:

Item Rewards

reward-command: "give %player% diamond 5"
reward-command: "give %player% emerald 3"
reward-command: "give %player% gold_ingot 10"

Economy Rewards

reward-command: "eco give %player% 1000"
reward-command: "money give %player% 500"

Multiple Commands

reward-command: 
  - "give %player% diamond 1"
  - "eco give %player% 100"
  - "title %player% title {\"text\":\"Winner!\",\"color\":\"gold\"}"

Complex Rewards

reward-command: "give %player% potion{Potion:minecraft:invisibility} 1"
reward-command: "lp user %player% permission settemp vip.temp true 1h"

Available Placeholders

  • %player%: Winner's username

  • %answer%: The correct answer that was given

  • %question%: The question that was asked

  • %time%: Time taken to answer (formatted)

Game Flow

  1. Automatic Trigger: Every interval minutes (if auto-send: true)

  2. Question Selection: Random question selected from games section

  3. Announcement: Multi-line announcement sent to all players

  4. Question Display: Question formatted and broadcast

  5. Answer Checking: All chat messages checked against answer list

  6. Winner Processing: First correct answer wins, reward executed

  7. Game End: Winner announcement or timeout message

Answer Matching

  • Case Insensitive: All answers compared without case sensitivity

  • Trimmed: Leading/trailing spaces removed from player input

  • Multiple Answers: Support for various correct responses

  • Exact Matching: No partial matches or fuzzy matching

Timing System

  • Question Start Time: Recorded when question is sent

  • Time Calculation: Winner's response time calculated automatically

  • Time Formatting:

    • Under 1 second: "500ms"

    • Under 1 minute: "5.2s"

    • Over 1 minute: "1m 30s"

Management Commands

Manual Triggers

  • /chat chatgames: Send random question immediately

  • Permission: primechat.chatgames

  • Checks: Games enabled, no active game, valid questions available

Administrative Features

  • Auto-Send Control: Controlled by settings.auto-send

  • Enable/Disable: Master switch via settings.enabled

  • Reload Support: Configuration reloaded with /chat reload

Advanced Configuration

Custom Categories

Organize questions by adding category comments:

games:
  # === GEOGRAPHY QUESTIONS ===
  geo-1:
    question: "What is the capital of Japan?"
    # ... configuration
    
  geo-2:
    question: "What is the largest continent?"
    # ... configuration
    
  # === MINECRAFT QUESTIONS ===
  mc-1:
    question: "What tool mines stone?"
    # ... configuration

Difficulty Levels

Create questions of varying difficulty with appropriate rewards:

games:
  # Easy question - basic reward
  easy-1:
    question: "What color is the sun?"
    answers: ["yellow", "Yellow"]
    reward-command: "give %player% gold_nugget 1"
    reward-display: "1x Gold Nugget"
    
  # Hard question - better reward
  hard-1:
    question: "What is the atomic number of carbon?"
    answers: ["6", "six", "Six"]
    reward-command: "give %player% diamond 5"
    reward-display: "5x Diamond"

Seasonal Questions

Add special questions for events or seasons:

games:
  # Halloween special
  halloween-1:
    question: "What do you say on Halloween for candy?"
    answers: ["trick or treat", "Trick or Treat"]
    reward-command: "give %player% pumpkin_pie 3"
    reward-display: "3x Pumpkin Pie"
    
  # Christmas special  
  christmas-1:
    question: "Who delivers presents on Christmas?"
    answers: ["santa", "Santa", "santa claus", "Santa Claus"]
    reward-command: "give %player% emerald 10"
    reward-display: "10x Emerald"

Troubleshooting

Common Issues

  1. Questions Not Sending

    • Check settings.enabled: true

    • Verify settings.auto-send: true

    • Ensure questions exist in games section

    • Check console for errors

  2. Rewards Not Working

    • Test reward commands manually in console

    • Verify placeholder format (%player%)

    • Check required plugins (EssentialsX for /give, economy plugin for money)

    • Ensure console has permission to run commands

  3. Answers Not Recognized

    • Check for typos in answer lists

    • Verify case variations are included

    • Test with simple, single-word answers first

    • Check console for chat processing errors

  4. Timing Issues

    • Verify server performance (lag can affect timing)

    • Check settings.timeout value

    • Ensure automatic intervals are reasonable

    • Monitor console for scheduler warnings

Debug Information

Enable debug mode for detailed logging:

# In config.yml
debug:
  enabled: true
  chat-games: true

This logs:

  • Question selection process

  • Answer checking attempts

  • Reward command execution

  • Timer events and timeouts

  • Configuration loading issues

Best Practices

Question Design

  1. Clear Wording: Avoid ambiguous questions

  2. Multiple Answers: Include common variations and spellings

  3. Appropriate Difficulty: Match your server's audience

  4. Fair Rewards: Balance reward value with question difficulty

  5. Educational Value: Make questions fun and informative

Performance Optimization

  1. Reasonable Intervals: Don't spam games too frequently

  2. Answer Efficiency: Keep answer lists concise but comprehensive

  3. Reward Commands: Use efficient commands that don't lag the server

  4. Question Database Size: Large databases are fine, random selection is efficient

Community Engagement

  1. Player Suggestions: Accept question submissions from players

  2. Themed Events: Create special question sets for events

  3. Difficulty Progression: Mix easy and hard questions

  4. Reward Variety: Use different types of rewards to maintain interest

Last updated