Chat Games

插件

· 作者 RareHyperIon

一款旨在通过向服务器中添加基于聊天的游戏来提升用户参与度的 Spigot 插件。

0 本站下载 0 关注 更新于 5 个月前

最新 1.4.6 · 1.21.11 · Sponge

一键开服(送7天)

ChatGames

一款 Minecraft 插件,通过基于聊天的互动小游戏(包括问答、数学挑战、文字重组和反应类游戏)来吸引服务器玩家参与。

为什么使用 ChatGames?

  • 即时、轻量级的聊天小游戏,保持聊天活跃。
  • 多平台支持:核心代码通过平台抽象层,兼容 Spigot、Paper、Folia 和 Sponge。
  • 游戏内容、定时安排、消息提示及奖励命令均可完全自定义配置。
  • 体积小、文档完善,易于扩展。

功能特性

  • 多种游戏类型:

    • Trivia - 正确回答常识问题
    • Math - 解决数学题
    • Unscramble - 还原打乱的单词
    • Multiple Choice - 从多个选项中选出正确答案
    • Reaction - 快速响应
  • 自动游戏调度 - 游戏可按设定的时间间隔自动开始

  • 自定义奖励 - 可配置玩家获胜时执行的命令(如经济奖励、物品发放等)

快速安装

  1. 将插件 .jar 文件放入服务器的 plugins/ 文件夹中。
  2. 启动服务器一次以生成默认配置文件。
  3. 编辑 config.yml、en-us.yml 以及各个游戏类型的配置文件。

配置说明

主配置文件

config.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
  ```
</details>

<details>
  <summary>language/en-us.yml</summary>

  ```yml
# ChatGames Language File - English (US)

# Message shown when a player tries to use a command they don't have access to
permission: "<red>You don't have permission to use this command.</red>"

# Message shown when ChatGames has been successfully reloaded
reload: "<green>Successfully reloaded ChatGames!</green>"

# Cooldown message when player tries to answer too quickly after wrong answer
cooldown: "<red>You cannot answer this question as you've already tried recently.</red>"

游戏配置文件

games/math.yml
name: math
display-name: "<gold>Math Wizard</gold>"
timeout: 60 # The time players have to win the game. (in seconds)

reward-commands:
  - "give {player} diamond {rand:1-3}"

messages:
  start: |
  
    <gold><bold>MATH WIZARD</bold></gold>
    <gray>Solve the equation below!</gray>
  
    {question}
  
  win: |
  
    <green><bold>✓</bold> <yellow>{player}</yellow> solved it!</green>
    <gray>Answer: <white>{answer}</white></gray>
  
  timeout: |
  
    <red><bold>✗</bold> Time's up!</red>
    <gray>Answer: <white>{answer}</white></gray>


questions:
  - ["<yellow>12 + 8 = ?</yellow>", "20"]
  - ["<yellow>25 - 7 = ?</yellow>", "18"]
  - ["<yellow>6 × 7 = ?</yellow>", "42"]
  - ["<yellow>144 ÷ 12 = ?</yellow>", "12"]
  - ["<yellow>15 + 23 = ?</yellow>", "38"]
  - ["<yellow>50 - 18 = ?</yellow>", "32"]
  - ["<yellow>9 × 8 = ?</yellow>", "72"]
  - ["<yellow>100 ÷ 5 = ?</yellow>", "20"]
games/multiple-choice.yml
name: multiple choice
display-name: "<green>Multiple Choice</green>"
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: |
  
    <green><bold>MULTIPLE CHOICE</bold></green>
    <gray>Type the correct letter!</gray>
  
    {question}
  
  win: |
  
    <green><bold>✓</bold> <yellow>{player}</yellow> chose correctly!</green>
    <gray>Answer: <white>{answer}</white></gray>
  
  timeout: |
  
    <red><bold>✗</bold> Nobody answered!</red>
    <gray>Correct: <white>{answer}</white></gray>


questions:
  q1:
    question: "<yellow>What is the largest planet in our solar system?</yellow>"
    answers:
      - "A. Earth"
      - "B. Jupiter"
      - "C. Saturn"
      - "D. Mars"
    correct-answer: "B"

  q2:
    question: "<yellow>Which programming language is Minecraft written in?</yellow>"
    answers:
      - "A. Python"
      - "B. C++"
      - "C. Java"
      - "D. JavaScript"
    correct-answer: "C"

  q3:
    question: "<yellow>What is 2 + 2 × 2?</yellow>"
    answers:
      - "A. 6"
      - "B. 8"
      - "C. 4"
      - "D. 10"
    correct-answer: "A"

  q4:
    question: "<yellow>Which mob drops blaze rods?</yellow>"
    answers:
      - "A. Ghast"
      - "B. Blaze"
      - "C. Wither Skeleton"
      - "D. Magma Cube"
    correct-answer: "B"
games/reaction.yml
  name: reaction
  display-name: "<red>反应测试</red>"
  timeout: 30 # 玩家赢得游戏的时间限制(秒)
  
  reward-commands:
    - "give {player} diamond {rand:1-3}"
  
  messages:
    start: |
    
      <red><bold>反应测试</bold></red>
      <gray>率先响应者胜!</gray>
    
      {question}
    
    win: |
    
      <green><bold>✓</bold> <yellow>{player}</yellow> 速度最快!</green>
    
    timeout: |
    
      <red><bold>✗</bold> 无人及时响应!</red>
  
  
  # 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: <button hover='Click me!'>Press here</button>
  #   - Without hover attribute, no hover text will be shown
  #   - You can include colors in the hover attribute.
  variants:
    - name: "快速输入"
      challenge: "<gold><bold>输入:<yellow>MINECRAFT</yellow></bold></gold>"
      answer: "MINECRAFT"
  
    - name: "首词"
      challenge: "<gold><bold>立即输入任意单词!</bold></gold>"
      answer: ""
  
    - name: "快速点击"
      challenge: "<button hover='点击获胜!' win><gold><bold>点击我获胜!</bold></gold></button>"
      answer: "CLICK"
  
    - name: "快速点击"
      challenge: "<yellow>点击星星!</yellow>\n\n<button win>[<gold><bold>⭐</bold></gold>]</button> <button>[<red><bold>❤</bold></red>️]</button> <button>[<green><bold>?</bold></green>]</button>"
      answer: "CLICK"
  
    - name: "颜色"
      challenge: "<gold><bold>输入:<yellow>RED</yellow></bold></gold>"
      answer: "RED"
games/trivia.yml
name: trivia
display-name: "<aqua>知识问答</aqua>"
timeout: 45 # 玩家赢得游戏的时间限制(秒)

reward-commands:
  - "give {player} emerald {rand:1-3}"

messages:
  start: |
  
    <aqua><bold>知识问答</bold></aqua>
    <gray>回答以下问题!</gray>
  
    {question}
  
  win: |
  
    <green><bold>✓</bold> <yellow>{player}</yellow> 答对了!</green>
    <gray>答案:<white>{answer}</white></gray>
  
  timeout: |
  
    <red><bold>✗</bold> 无人答对!</red>
    <gray>答案:<white>{answer}</white></gray>


questions:
  - ["<yellow>法国的首都是什么?</yellow>", "Paris"]
  - ["<yellow>一共有多少个大洲?</yellow>", "7"]
  - ["<yellow>泰坦尼克号沉没于哪一年?</yellow>", "1912"]
  - ["<yellow>最大的海洋是哪个?</yellow>", "Pacific"]
  - ["<yellow>谁绘制了《蒙娜丽莎》?</yellow>", "Leonardo da Vinci"]
  - ["<yellow>光速是多少?</yellow>", "299792458"]
  - ["<yellow>H2O通常被称为什么?</yellow>", "Water"]
games/unscramble.yml
name: unscramble
display-name: "<light_purple>单词拼写</light_purple>"
timeout: 60 # 玩家赢得游戏的时间限制(秒)

reward-commands:
  - "give {player} gold_ingot {rand:1-5}"

messages:
  start: |
  
    <light_purple><bold>单词拼写</bold></light_purple>
    <gray>解开这个单词!</gray>
  
    {question}
  
  win: |
  
    <green><bold>✓</bold> <yellow>{player}</yellow> 拼对了!</green>
    <gray>单词:<white>{answer}</white></gray>
  
  timeout: |
  
    <red><bold>✗</bold> 时间到!</red>
    <gray>单词:<white>{answer}</white></gray>

words: [
  "SMARTPHONE", "COMPUTER", "GAMING",
  "KEYBOARD", "MINECRAFT", "DIAMOND",
  "ADVENTURE", "TREE", "GOLD", "LOG"
]

支持的平台与版本

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

命令

Command Permission Description
/chatgames reload chatgames.reload 重新加载所有配置
/chatgames start <game> chatgames.start 手动开始一局游戏
/chatgames stop chatgames.stop 停止当前游戏
/chatgames list chatgames.list 列出所有可用游戏
/chatgames info chatgames.info 显示插件信息
/chatgames toggle chatgames.toggle 切换自动游戏的开启或关闭状态

权限

Permission Description
chatgames.reload 允许重新加载插件
chatgames.start 允许手动开始游戏
chatgames.stop 允许停止当前游戏
chatgames.list 允许列出所有可用游戏
chatgames.info 允许查看插件信息
chatgames.toggle 允许切换自动游戏

故障排除

游戏未启动:

  • 检查 config.yml 中的 minimum-players 设置
  • 确认在线玩家数量是否足够
  • 检查控制台是否有错误日志

奖励未生效:

  • 验证占位符格式是否为 {player}
  • 检查控制台是否有命令执行错误

问题未加载:

  • 验证游戏配置文件中的 YAML 语法
  • 修改后使用 /chatgames reload 重新加载
  • 检查控制台是否有解析错误

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源