Описание
# ChatGames
A Minecraft plugin that adds interactive chat-based minigames to engage your server's players with trivia, math challenges, word scrambles, and reaction games.
## Why use ChatGames?
- Instant, lightweight chat minigames that keep your chat active.
- Multi-platform: same core works across Spigot, Paper, Folia, and Sponge via a platform abstraction layer.
- Fully configurable games, schedules, messages and reward commands.
- Small, well-documented, and easy to extend.
## Features
- **Multiple Game Types:**
- **Trivia** - Answer trivia questions correctly
- **Math** - Solve math problems
- **Unscramble** - Unscramble words
- **Multiple Choice** - Pick the correct answer from several options
- **Reaction** - Respond quickly
- **Automatic Game Scheduling** - Games start automatically at configurable intervals
- **Customizable Rewards** - Configure commands to run when players win (economy rewards, items, etc.)
## Quick Install
1. Drop the plugin `.jar` into your server's `plugins/` folder.
2. Start the server once to generate default configurations.
3. Edit `config.yml`, `en-us.yml`, and the individual game files.
## Configuration
### Main Configuration
config.yml
```yml
# ChatGames Configuration
# https://github.com/RareHyperIon/ChatGames
# Available: en-us
language: en-us
# Interval between automatic games (in seconds)
game-interval: 300
# Minimum players online to start automatic games
minimum-players: 1
# Whether to automatically start games at intervals
automatic-games: true
# Cooldown after wrong answer in multiple choice (in ticks, 20 ticks = 1 second)
answer-cooldown-ticks: 60
# Enable debug logging
debug: false
```
language/en-us.yml
```yml
# ChatGames Language File - English (US)
# Message shown when a player tries to use a command they don't have access to
permission: "You don't have permission to use this command."
# Message shown when ChatGames has been successfully reloaded
reload: "Successfully reloaded ChatGames!"
# Cooldown message when player tries to answer too quickly after wrong answer
cooldown: "You cannot answer this question as you've already tried recently."
```
### Game Configuration
games/math.yml
```yml
name: math
display-name: "Math Wizard"
timeout: 60 # The time players have to win the game. (in seconds)
reward-commands:
- "give {player} diamond {rand:1-3}"
messages:
start: |
MATH WIZARD
Solve the equation below!
{question}
win: |
✓ {player} solved it!
Answer: {answer}
timeout: |
✗ Time's up!
Answer: {answer}
questions:
- ["12 + 8 = ?", "20"]
- ["25 - 7 = ?", "18"]
- ["6 × 7 = ?", "42"]
- ["144 ÷ 12 = ?", "12"]
- ["15 + 23 = ?", "38"]
- ["50 - 18 = ?", "32"]
- ["9 × 8 = ?", "72"]
- ["100 ÷ 5 = ?", "20"]
```
games/multiple-choice.yml
```yml
name: multiple choice
display-name: "Multiple Choice"
timeout: 45 # The time players have to win the game. (in seconds)
cooldown: 60 # Ticks to wait after wrong answer (60 ticks = 3 seconds)
reward-commands:
- "give {player} emerald {rand:1-3}"
messages:
start: |
MULTIPLE CHOICE
Type the correct letter!
{question}
win: |
✓ {player} chose correctly!
Answer: {answer}
timeout: |
✗ Nobody answered!
Correct: {answer}
questions:
q1:
question: "What is the largest planet in our solar system?"
answers:
- "A. Earth"
- "B. Jupiter"
- "C. Saturn"
- "D. Mars"
correct-answer: "B"
q2:
question: "Which programming language is Minecraft written in?"
answers:
- "A. Python"
- "B. C++"
- "C. Java"
- "D. JavaScript"
correct-answer: "C"
q3:
question: "What is 2 + 2 × 2?"
answers:
- "A. 6"
- "B. 8"
- "C. 4"
- "D. 10"
correct-answer: "A"
q4:
question: "Which mob drops blaze rods?"
answers:
- "A. Ghast"
- "B. Blaze"
- "C. Wither Skeleton"
- "D. Magma Cube"
correct-answer: "B"
```
games/reaction.yml
```yml
name: reaction
display-name: "Reaction Test"
timeout: 30 # The time players have to win the game. (in seconds)
reward-commands:
- "give {player} diamond {rand:1-3}"
messages:
start: |
REACTION TEST
Be the first to respond!
{question}
win: |
✓ {player} was fastest!
timeout: |
✗ Nobody reacted in time!
# Variants allow different reaction challenges
# If answer is empty string "", any message wins (fastest typer)
# If answer is specified, must type that exact word
# If answer is "CLICK", then it will be clickable.
# - Optional: Add hover="Your text" for custom hover message
# - Example: Press here
# - Without hover attribute, no hover text will be shown
# - You can include colors in the hover attribute.
variants:
- name: "Type Fast"
challenge: "Type: MINECRAFT"
answer: "MINECRAFT"
- name: "First Word"
challenge: "Type any word now!"
answer: ""
- name: "Click Fast"
challenge: "Click me to win!"
answer: "CLICK"
- name: "Click Fast"
challenge: "Click the star!\n\n[⭐] [❤️] [🟢]"
answer: "CLICK"
- name: "Color"
challenge: "Type: RED"
answer: "RED"
```
games/trivia.yml
```yml
name: trivia
display-name: "Trivia Time"
timeout: 45 # The time players have to win the game. (in seconds)
reward-commands:
- "give {player} emerald {rand:1-3}"
messages:
start: |
TRIVIA TIME
Answer the question below!
{question}
win: |
✓ {player} got it right!
Answer: {answer}
timeout: |
✗ Nobody got it!
Answer: {answer}
questions:
- ["What is the capital of France?", "Paris"]
- ["How many continents are there?", "7"]
- ["What year did the Titanic sink?", "1912"]
- ["What is the largest ocean?", "Pacific"]
- ["Who painted the Mona Lisa?", "Leonardo da Vinci"]
- ["What is the speed of light?", "299792458"]
- ["What is H2O commonly known as?", "Water"]
```
games/unscramble.yml
```yml
name: unscramble
display-name: "Word Scramble"
timeout: 60 # The time players have to win the game. (in seconds)
reward-commands:
- "give {player} gold_ingot {rand:1-5}"
messages:
start: |
WORD SCRAMBLE
Unscramble the word!
{question}
win: |
✓ {player} unscrambled it!
Word: {answer}
timeout: |
✗ Time ran out!
Word: {answer}
words: [
"SMARTPHONE", "COMPUTER", "GAMING",
"KEYBOARD", "MINECRAFT", "DIAMOND",
"ADVENTURE", "TREE", "GOLD", "LOG"
]
```
## Supported Platforms & Versions
| Platform | Supported Versions |
|----------|--------------------|
| Spigot | 1.13.x – 1.21.x |
| Paper | 1.20.6 – 1.21.x |
| Folia | 1.20.6 – 1.21.x |
| Sponge | 1.21.x |
## Commands
| Command | Permission | Description |
|---------------------------|--------------------|----------------------------------|
| `/chatgames reload` | `chatgames.reload` | Reload all configurations |
| `/chatgames start ` | `chatgames.start` | Manually start a game |
| `/chatgames stop` | `chatgames.stop` | Stop the current game |
| `/chatgames list` | `chatgames.list` | List all available games |
| `/chatgames info` | `chatgames.info` | Show plugin information |
| `/chatgames toggle` | `chatgames.toggle` | Toggle automatic games on or off |
## Permissions
| Permission | Description |
|--------------------|------------------------------------|
| `chatgames.reload` | Allows reloading the plugin |
| `chatgames.start` | Allows manually starting a game |
| `chatgames.stop` | Allows stopping the current game |
| `chatgames.list` | Allows listing all available games |
| `chatgames.info` | Allows viewing plugin information |
| `chatgames.toggle` | Allows toggling automatic games |
## Troubleshooting
**Games not starting:**
- Check `minimum-players` setting in `config.yml`
- Verify enough players are online
- Check console for errors
**Rewards not working:**
- Verify placeholder format is `{player}`
- Check console for command errors
**Questions not loading:**
- Verify YAML syntax in game config files
- Use `/chatgames reload` after making changes
- Check console for parsing errors