Server Quiz

插件

· 作者 RunicDolphin806

在 Minecraft 服务器中通过 GUI 回答问题!

0 本站下载 0 关注 更新于 1 周前

最新 2.0.0 · 26.2 · Paper / Spigot

一键开服(送7天)

Server Quiz

该插件基于 org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT,是从我的上一个项目 zhisuan11core 分支出来的。

通常来说,你可以将其视为一个简单的数据库管理系统,用于在 Minecraft 服务器中管理问答系统。

它也有助于我为数据库系统课程作业做准备。

现在,它使用 AnvilGUI 来提供填空式答题系统。

配置

问答系统有两种数据存储方式:YAML、MYSQL。

自插件版本 1.1.0 起,支持填空题!

YAML

如果你选择 YAML 类型,题库将作为单个文件存储在 plugins/ServerQuiz/quiz/ 目录下。 文件名来自 config.yml 中的 config.table,例如 choice 对应加载 quiz/choice.yml。

每个文件的头部声明其类型,并在 entry 下列出题目项。题目字段使用与 MYSQL 列相同的名称(question、option_a ~ option_d、answer、score、reward)。

quiz/choice.yml:

type: choice
entry:
  - question: "Which of the following is not a valid IP address?"
    option_a: "172.28.45.56"
    option_b: "192.168.0.1"
    option_c: "240e:360:6f43:500:d14d:dbd0:97:b3b3"
    option_d: "127.256.3.34"
    answer: D
    score: 10
    reward: DIAMOND

quiz/blank.yml:

type: blank
entry:
  - question: "1+1=?"
    answer: "2"
    score: 10
    reward: DIAMOND

从旧版本升级?插件会自动将旧的 Quiz.yml 拆分为 quiz/choice.yml 和 quiz/blank.yml,然后将原始文件重命名为 Quiz.yml.migrated。 使用之前 Choice: / Blank: 部分的文件仍会被读取,并在下次保存题库时以新格式重写。

对于多选题,用逗号分隔所有正确标签,例如 answer: "A,C"。标签的顺序无关紧要,选项在答题界面上仍然随机打乱。

MYSQL

如果你偏好 MYSQL,请创建一个名为 serverquiz 的新数据库,并提前设置好基本配置:

config:
  storage: MYSQL
  host: { your host }
  port: { your port }
  name: { your name }
  password: { your password }
  database: serverquiz
  # 同一数据库中的任何数量的题库表
  table:
    - choice
    - blank
    - history

你可以加载任意数量的题库。使用 YAML 时,table 中的每一项都是 quiz/ 下的一个文件;使用 MYSQL 时,每一项是同一数据库中的一个表。题库按列出顺序读取并依次编号。对于 MYSQL,通过列来识别表:

  • 包含 option_a ~ option_d 的表被加载为 选择题 题库。
  • 不包含这些列的表被加载为 填空题 题库。
  • 每张表至少需要 id、question、answer、score 和 reward 列;缺失的 score/reward 列会自动添加。
  • 不存在的表或模式不兼容的表将被跳过并发出警告。

添加、删除或编辑表后,执行 /quiz reload 即可生效,无需重启服务器。

配置文件已更新!你现在可以轻松设置一些配置。其他配置选项如下所示:

###########################################
##             Update checker            ##
###########################################

updateChecker:
  # Option: modrinth/github
  source: modrinth
  enable: true

##############################################
##            Broadcast messages            ##
##############################################

broadcast:
  # The text must be written in a single line
  text: "§e============\n§6§lNew Quiz begins! \n【Click here】 to join§r§e\n============"
  hover: "§7Click to join Server Quiz!"
  # When to broadcast the next quiz. Must be a quoted cron expression.
  # 5 fields: minute hour day-of-month month day-of-week
  # 6 fields: second minute hour day-of-month month day-of-week
  # Day of week: 0 or 7 = Sunday, 1-6 = Monday-Saturday.
  # Examples:
  #   "*/15 * * * *"   every 15 minutes
  #   "0 */2 * * *"    every 2 hours at minute 0
  #   "0 0 20 * * *"   every day at 20:00:00
  # If the expression is missing or invalid, the plugin falls back to 900 seconds.
  interval: "*/15 * * * *"

##############################################
##             Answer messages              ##
##############################################

messages:
  # A player has already given the correct answer
  hasWinner: "The quiz has already been solved!"
  # You have answered the quiz
  hasAnswered: "You have already answered this quiz!"
  # Your answer is right
  correct: "You have solved the quiz!"
  # Your answer is wrong
  wrong: "Your answer is wrong!"
  # Send Reward
  sendReward: "Reward has been sent to you: "
  # Update player's score
  score: "Your score board has been updated!"

##############################################
##              The GUI text                ##
##############################################

gui:
  title: "Quiz Menu"
  question: "Question"
  reward: "Reward"
  # Available for choice quiz
  choice:
    option: "Option "
    # Whether to arrange options randomly
    random: true
  # Available for blank quiz
  blank:
    answerSheet: "Answer sheet"
    answerTitle: "Type your Answer"
  # Scoreboard settings
  scoreBoard:
    title: "§rYour quiz score board"
    # ServerQuiz has some built-in variables, which can be used here:
    # - %serverquiz_name% : the player's name
    # - %serverquiz_correct% : the number of questions correctly answered by the player
    # - %serverquiz_total% : the total number of questions answered by the player
    # - %serverquiz_accuracy% : the accuracy of the player answering questions
    lore:
      - ""
      - "§ePlayer: §f %serverquiz_name%"
      - "§eCorrect: §f %serverquiz_correct%"
      - "§eTotal: §f %serverquiz_total%"
      - "§eAccuracy: §f %serverquiz_accuracy%"

命令

命令 功能 权限
/quiz open 打开答题菜单 serverquiz.open
/quiz send <num> 发送一个测验 serverquiz.edit
/quiz show 显示配置详情 serverquiz.show
/quiz edit 编辑配置 serverquiz.edit
/quiz reload 重新加载配置 serverquiz.edit

你可以在游戏中管理测验条目:

# 选择题库
/quiz edit entry <table> insert <question> <optionA> <optionB> <optionC> <optionD> <answer> <score> <reward>
/quiz edit entry <table> alter <id> <question> <optionA> <optionB> <optionC> <optionD> <answer> <score> <reward>

# 填空题库
/quiz edit entry <table> insert <question> <answer> <score> <reward>
/quiz edit entry <table> alter <id> <question> <answer> <score> <reward>

<id> 是通过 /quiz show info <id> 显示的测验全局 ID。编辑后请运行 /quiz reload 以应用更改。

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

评论 0

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

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源