仅在 Minecraft 版本 1.21.11 上测试
适用于 Bukkit/Spigot/Paper 服务器的灵活游戏内投票和调查系统。
管理员可以创建基于命令的调查,而普通玩家可以使用管理员批准的模板创建受限的静默调查。调查以 GUI 形式显示,支持重复、提醒、持久化和多语言消息。
功能
- 游戏内是/否投票
- 由管理员控制并完全可配置的调查
- 仅限白名单模板的玩家创建调查
- 可选的重复调查
- 静默调查(无广播或提醒)
- 基于 GUI 的调查列表和详细视图
- 持久化存储(重启后保留)
- 可配置的提醒
- 语言和消息自定义
- 投票历史记录追踪
安装
-
将插件 JAR 文件放入 plugins/ 文件夹
-
启动服务器一次以生成配置文件
-
进行配置:
config.yml
lang.yml
polls.yml
history.yml
-
使用以下命令重新加载配置:
/votepoll reload
核心概念
调查 (Poll)
调查代表一次投票,具有以下属性:
- 唯一 ID(随机生成或指定)
- 显示名称
- 描述
- 成功时执行的控制台命令
- 持续时间(秒)
- 最低赞成/反对票数
- 可选的重复间隔
- 静默标志
- 创建者(玩家、管理员或控制台)
支持的命令占位符:
模板 (customCommands)
在 config.yml 中定义调查模板。
它们是可重用且安全的预定义命令。
只有列在 playerAllowedCommands 中的模板才能被非管理员玩家使用。
玩家创建的调查
- 只能从允许的模板创建
- 始终获得随机调查 ID
- 始终为静默模式
- 无全局通知或提醒
- 仅通过 GUI 可见
示例:
/votepoll add example_ban --target=RareHuman
管理员创建的调查
- 完全控制所有调查参数
- 可以向玩家广播
- 可以发送提醒
- 可以是重复的或静默的
- 可以指定自定义 ID
命令
玩家命令
打开调查 GUI:
/votepoll
预览调查信息:
/preview <id>
从允许的模板创建调查:
/votepoll add <templateId> [--target=PLAYER]
对调查投票:
/vote <pollId> yes
/vote <pollId> no
切换提醒:
/votepoll notify on
/votepoll notify off
设置语言:
/votelang <languageCode>
管理员命令 (votepoll.admin 或 OP)
创建调查:
/votepoll add [id] <duration> <minYes> <minNo> "<display>" <command> [flags]
支持的标志:
--target=PLAYER
--repeat
--repeat=SECONDS
--interval=SECONDS
--silent
--display=NAME
示例:
/votepoll add banVote 300 5 3 "Ban toxic player" ban {target} --target=BadPlayer
/votepoll add 600 4 2 "Restart server?" restart --silent
其他管理员命令:
/votepoll cancel <id>
/votepoll reload
/votepoll preview <id>
GUI
活跃投票 GUI
-
列出所有活跃调查
-
显示完整的调查信息:
- 名称
- 描述
- 命令
- 结束日期
- 创建者
- 所需赞成/反对票数
- 调查 ID
- 剩余时间
- 投票命令
调查详情 GUI
通知与提醒
-
管理员创建的调查:
- 创建时广播
- 根据
reminderIntervalSeconds 定期提醒
-
玩家创建的调查:
-
玩家可以单独选择退出提醒
持久化
polls.yml 存储活跃调查
history.yml 存储已完成的调查
- 服务器重启后调查能正确恢复
配置示例
reminderIntervalSeconds: 1800
defaultRepeatIntervalSeconds: 60
playerAllowedCommands:
- "example_ban"
customCommands:
- id: "example_ban"
display: "Ban example player"
description: "Ban a player for breaking rules"
command: "ban {target} Breaking server rules"
durationSeconds: 300
minYes: 5
minNo: 3
repeat: false
repeatIntervalSeconds: 0
messages:
usage_votepoll: "&cUsage: /votepoll add|cancel|list|reload|notify"
no_permission: "&cYou don't have permission to do that."
usage_cancel: "&cUsage: /votepoll cancel <id>"
unknown_subcommand: "&cUnknown subcommand."
vote_failed: "&cUnable to vote."
poll_canceled: "&cVote canceled: &6{display} (id: {id})"
broadcast_new_poll: "&aNew vote created: &6{display} &f(id: {id})"
vote_passed: "&aVote passed: &6{display}"
vote_failed: "&cVote failed: &6{display}"
vote_passed_majority: "&aVote passed (majority): &6{display}"
vote_failed_majority: "&cVote failed (majority): &6{display}"
权限
| 权限 |
描述 |
votepoll.admin |
完全管理访问权限 |
| none |
用于投票和使用允许模板所需的权限 |
重要行为说明
- 如果模板未列在
playerAllowedCommands 中,玩家会收到权限错误
- 玩家创建的调查在设计上就是静默的
- 如果重复调查没有有效的间隔,则使用
defaultRepeatIntervalSeconds
Testet only on mc version 1.21.11
flexible in-game voting and polling system for Bukkit/Spigot/Paper servers.
Admins can create command-based polls, while regular players can create restricted, silent polls from admin-approved templates. Polls are displayed in a GUI, support repetition, reminders, persistence, and multilingual messages.
Features
- In-game YES / NO voting
- Admin-controlled polls with full configuration
- Player-created polls limited to whitelisted templates
- Optional repeating polls
- Silent polls (no broadcast or reminders)
- GUI-based poll list and detailed view
- Persistent storage (survives restarts)
- Configurable reminders
- Language and message customization
- Vote history tracking
Installation
-
Place the plugin JAR into the plugins/ folder
-
Start the server once to generate config files
-
Configure:
config.yml
lang.yml
polls.yml
history.yml
-
Reload configuration with:
/votepoll reload
Core Concepts
Poll
A poll represents a vote with the following properties:
- Unique ID (random or specified)
- Display name
- Description
- Console command to execute on success
- Duration (seconds)
- Minimum YES / NO votes
- Optional repeat interval
- Silent flag
- Creator (player, admin, or console)
Supported command placeholders:
Templates (customCommands)
Poll templates defined in config.yml.
They are reusable and safe predefined commands.
Only templates listed in playerAllowedCommands can be used by non-admin players.
Player-Created Polls
- Can only be created from allowed templates
- Always receive a random poll ID
- Always silent
- No global notifications or reminders
- Visible only via GUI
Example:
/votepoll add example_ban --target=RareHuman
Admin-Created Polls
- Full control over all poll parameters
- Can broadcast to players
- Can send reminders
- Can be repeating or silent
- Can specify custom IDs
Commands
Player Commands
Open poll GUI:
/votepoll
Preview the poll info:
/preview <id>
Create a poll from an allowed template:
/votepoll add <templateId> [--target=PLAYER]
Vote on a poll:
/vote <pollId> yes
/vote <pollId> no
Toggle reminders:
/votepoll notify on
/votepoll notify off
Set language:
/votelang <languageCode>
Admin Commands (votepoll.admin or OP)
Create a poll:
/votepoll add [id] <duration> <minYes> <minNo> "<display>" <command> [flags]
Supported flags:
--target=PLAYER
--repeat
--repeat=SECONDS
--interval=SECONDS
--silent
--display=NAME
Examples:
/votepoll add banVote 300 5 3 "Ban toxic player" ban {target} --target=BadPlayer
/votepoll add 600 4 2 "Restart server?" restart --silent
Other admin commands:
/votepoll cancel <id>
/votepoll reload
/votepoll preview <id>
GUI
Active Votes GUI
Poll Detail GUI
- Shows the same information as notifications
- Includes YES and NO voting buttons
Notifications and Reminders
Persistence
polls.yml stores active polls
history.yml stores completed polls
- Polls resume correctly after server restart
Configuration Example
reminderIntervalSeconds: 1800
defaultRepeatIntervalSeconds: 60
playerAllowedCommands:
- "example_ban"
customCommands:
- id: "example_ban"
display: "Ban example player"
description: "Ban a player for breaking rules"
command: "ban {target} Breaking server rules"
durationSeconds: 300
minYes: 5
minNo: 3
repeat: false
repeatIntervalSeconds: 0
messages:
usage_votepoll: "&cUsage: /votepoll add|cancel|list|reload|notify"
no_permission: "&cYou don't have permission to do that."
usage_cancel: "&cUsage: /votepoll cancel <id>"
unknown_subcommand: "&cUnknown subcommand."
vote_failed: "&cUnable to vote."
poll_canceled: "&cVote canceled: &6{display} (id: {id})"
broadcast_new_poll: "&aNew vote created: &6{display} &f(id: {id})"
vote_passed: "&aVote passed: &6{display}"
vote_failed: "&cVote failed: &6{display}"
vote_passed_majority: "&aVote passed (majority): &6{display}"
vote_failed_majority: "&cVote failed (majority): &6{display}"
Permissions
| Permission |
Description |
votepoll.admin |
Full administrative access |
| none |
Required for voting and allowed templates |
Important Behavior
- Players receive a permission error if the template is not listed in
playerAllowedCommands
- Player-created polls are silent by design
- If a repeating poll has no valid interval,
defaultRepeatIntervalSeconds is used
评论 0
登录后参与评分
还没有评论,来抢沙发吧