要求
- 运行中的 Hytale 服务器
- Java 25 或更高版本
- 已安装 WebServer 插件(Hytale 推荐的插件)
- 访问服务器配置文件
安装 SimpleVotifier
安装插件
将 SimpleVotifier.jar 文件复制到 Hytale 服务器的 mods/ 文件夹。
mods/SimpleVotifier.jar
验证 WebServer
确保 WebServer 插件(Hytale 推荐的插件)已安装并正常运行。
启动服务器
启动您的 Hytale 服务器,让 SimpleVotifier 自动生成其配置。
配置插件
根据您的需要编辑生成的配置文件(参见配置部分)。
配置
首次启动后,SimpleVotifier 自动创建配置文件 mods/SimpleVotifier/config.json。
默认配置
mods/SimpleVotifier/config.json
{
"language": "cn",
"token": "AbCdEfGh123456789XyZ0123",
"allowedIps": [],
"logVotes": true,
"broadcastVotes": true,
"rewards": {
"enabled": false,
"monthlyReset": true,
"everyVoteCommands": [
"give {player} Plant_Crop_Carrot_Item"
],
"tiers": [
{
"votesRequired": 10,
"commands": ["give {player} Container_Bucket"]
},
{
"votesRequired": 50,
"commands": ["give {player} Armor_Iron_Head"]
},
{
"votesRequired": 100,
"commands": ["give {player} Rock_Gem_Diamond"]
}
]
},
"leaderboard": {
"enabled": true,
"format": "html",
"showVoteSites": true
},
"voteSites": [
{
"service": "Top-Games",
"url": "https://top-games.net/hytale/my-server"
}
]
}
配置选项
| 选项 | 类型 | 描述 |
|---|---|---|
language |
string | 语言代码 (en, fr, es, de, it, pt, ru, uk, zh, ja) |
token |
string | HMAC 认证的安全令牌(自动生成) |
allowedIps |
array | IP 白名单(空 = 允许所有) |
logVotes |
boolean | 在控制台显示投票 |
broadcastVotes |
boolean | 向所有玩家广播投票 |
Top-Games 配置
获取您的令牌
SimpleVotifier 自动生成一个令牌,您需要从配置文件中获取。
mods/SimpleVotifier/config.json
在 Top-Games 中配置
前往您的 Top-Games 面板,Hytale 服务器的"Votifier"部分。
- 启用"SimpleVotifier"
- 输入您服务器的 IP
- 端口:默认为服务器端口 + 3(例如:
5523) - 输入 config.json 中的令牌
测试连接
使用 Top-Games 面板中的"测试"按钮验证通信是否正常工作。
奖励系统(可选)
SimpleVotifier 包含内置奖励系统,每次投票执行命令并有等级奖励。
奖励配置
config.json (rewards section)
{
"rewards": {
"enabled": true,
"monthlyReset": true,
"everyVoteCommands": ["give {player} Plant_Crop_Carrot_Item"],
"tiers": [
{
"votesRequired": 10,
"commands": ["give {player} Container_Bucket"]
},
{
"votesRequired": 50,
"commands": ["give {player} Armor_Iron_Head"]
},
{
"votesRequired": 100,
"commands": ["give {player} Rock_Gem_Diamond"]
}
]
}
}
玩家命令
| 命令 | 描述 |
|---|---|
/rewards |
领取待领取的投票奖励 |
/vote |
显示配置的投票链接 |
/voteinfo |
查看投票统计和等级进度 |
开发者 API
第三方插件可以通过 Hytale EventBus 监听投票事件。
MyPlugin.java
import com.hypixel.hytale.server.core.HytaleServer;
import net.top_games.hytale.plugins.simplevotifier.VoteEvent;
public class MyPlugin extends JavaPlugin {
@Override
protected void setup() {
HytaleServer.get().getEventBus()
.listenFor(VoteEvent.class, null)
.listen(this::onVote);
}
private void onVote(VoteEvent event) {
String username = event.getUsername();
String service = event.getServiceName();
getLogger().atInfo().log(username + " voted on " + service);
// Add your custom logic here
}
}
排行榜(可选)
SimpleVotifier 包含排行榜端点,用于显示服务器上的最佳投票者。
排行榜配置
config.json (leaderboard section)
{
"leaderboard": {
"enabled": true,
"format": "html",
"showVoteSites": true
}
}
排行榜选项
| 选项 | 类型 | 描述 |
|---|---|---|
enabled |
boolean | 启用/禁用排行榜端点(默认禁用) |
format |
string | 默认输出格式:"html"或"json"(默认 html) |
showVoteSites |
boolean | 在排行榜上显示/隐藏投票网站部分 |
排行榜端点
GET https://your-server:port/Top-Games/SimpleVotifier/leaderboard
故障排除
- 检查 WebServer 插件是否已安装
- 检查服务器日志中的错误消息
- 检查 HMAC 签名是否正确生成
- 检查 allowedIps 配置
- 检查服务器日志中的错误消息
- 确保 rewards.enabled 设置为 true
- 检查配置中的命令语法
- 检查玩家是否在线或使用 /rewards 领取
- 确认 monthlyReset 已启用
- 检查 last_reset.txt 文件的最后重置日期
- 重置在新月份的第一次投票时触发
信息
功能
- 安全的 HMAC-SHA256 认证
- 内置奖励系统
- 支持 10 种语言
- 向所有玩家广播投票
- 每月投票重置
- 第三方插件的事件 API
- 排行榜端点(HTML/JSON)
配置摘要
- 安装 WebServer 插件
- 安装 SimpleVotifier
- 配置 config.json
- 在 Top-Games 中配置
- 测试连接
- 配置奖励
- 配置排行榜