服务器使用量
1
服务玩家数
0
下载量
4,048
插件详细介绍
这个插件可以让你在服务器中为 Twitch 订阅者或关注者发放专属奖励。你可以给他们设置称号/权限组,或执行命令,不过在使用前需要先完成一些配置。
功能简介
- 为 Twitch 订阅者或关注者发放服务器奖励
- 可为玩家赋予 rank
- 可在玩家完成同步后自动执行命令
- 支持撤销订阅/关注奖励
- 提供开发者事件接口
前置要求
- 你的服务器必须托管在 VPS 或 Dedicated server 上
- Shared hosting 不可用
- 插件会自动在
8080端口上启动一个 web server(可配置)
安装与设置
Twitch 应用创建步骤
- 登录 https://dev.twitch.tv/
- 点击右上角的 Your Dashboard
- 点击 Applications
- 在右侧点击 Register Your Application
- 选择一个名称,例如
Yourname Minecraft Subscriber sync - 当用户同步账号时,这个名称会显示给他们
- 在 redirect URI 中填写
http://your-server-ip:8080 - 如果你有绑定到服务器 IP 的域名,也可以用域名替代 IP
- 分类选择 Game Integration
- 复制 client ID
- 生成并复制 client secret
- 后面配置时会用到这两项
插件安装步骤
- 关闭 Minecraft 服务器
- 将插件放入服务器中
- 启动服务器
- 等插件生成配置文件后,再次关闭服务器
- 打开配置文件,填写以下内容:
- 你的频道名称
client IDclient secret- 你还需要把
redirect-uri改成你在 Twitch 中设置的那个 redirect URI - 按需修改其他配置项
- 重新启动服务器
玩家同步步骤
- 在游戏内执行
/twitchsync - 插件会打开一个 URL
- 点击该 URL 后,应当会跳转到你之前设置的 redirect URI
- 如果一切正常,你会收到消息:
"You have successfully received the Twitch subscription rewards."- 如果收到未知错误消息,请多尝试几次
- 如果问题仍然存在:
- 在配置中启用
debug-mode - 在收到未知错误时,把控制台日志私信发送给作者
配置说明
默认配置
# The channel name(s) to check for subscription/follows.
channel-names:
- required
# The client ID given by Twitch.
client-id: required
# The client secret given by Twitch. Remember not to tell anyone this!
client-secret: required
# Port to host the HTTP server on
server-port: 8080
# Redirect URI for Twitch authentication. This has to be set as the same as Twitch
redirect-uri: http://localhost:8080
# How many minutes it takes for twitch sync URLs to expire.
expiry-time: 10
# Note that these messages are sent by the web server and use HTML, not chat formatting.
messages:
subscription:
no-subscription-program: "The channel does not have a subscription program set up."
success: "You have successfully received the Twitch subscription rewards."
follow:
success: "You have successfully received the Twitch following rewards."
success-both: "You have received both the following and subscription rewards."
# If you have subscription or following rewards disabled you might want to change this
# to say "You are not following" or "You are not subscribed" to make it clear
# that it's only possible to get rewards for one thing
not-both: "You are neither subscribed or are following the channel."
already-done: "You have already redeemed subscription and/or follow rewards."
state-not-found: "This link has either expired, or already been used."
player-not-found: "We cannot find you on the server. Are you online?"
invalid-url: "The URL is invalid"
unknown-error: "An unknown error occurred. Please try again."
# revoke subscriber/follow rewards every X days
# this will remove the rank and run revoke-commands
revoke-interval-days: 1
# What to do when somebody subscribes
subscribe:
enabled: true
# Rank to give a player. Only used if Vault and a permissions plugin is installed.
# Set to 'none' to disable.
rank: 'Subscriber'
# Commands to execute.
# You can use the following placeholders:
# %name% - name of the player who subscribed
# %channel% - channel their subscription is registered to
# %channelid% - channel id of %channel%
commands:
- 'broadcast %name% has subscribed!'
- 'give %name% diamond 1'
# commands to run when a player is no longer subscribed
# this only supports the %name% placeholder
revoke-commands:
- 'give %name% dirt 1'
# What to do when somebody follows
follow:
enabled: true
rank: 'Follower'
commands:
- 'broadcast %name% has followed the channel!'
revoke-commands:
- 'broadcast %name% has unfollowed :('
# Enable debugging information.
# If you encounter an unexpected error please enable this
# and send the results to the dev!
debug-mode: false配置要点
channel-names- 要检查订阅/关注状态的频道名称列表
client-id- Twitch 提供的 client ID
client-secret- Twitch 提供的 client secret
- 请不要泄露给他人
server-port- HTTP 服务器监听端口,默认是
8080 redirect-uri- Twitch 身份验证回调地址
- 必须与 Twitch 后台设置的值完全一致
expiry-time/twitchsync生成的同步链接过期时间,单位为分钟revoke-interval-days- 每隔多少天撤销一次订阅/关注奖励
- 会移除 rank,并执行
revoke-commands debug-mode- 是否启用调试模式
- 遇到异常错误时建议开启
消息说明
messages下的提示消息由 web server 发送- 这些消息使用的是 HTML,而不是聊天格式
订阅奖励配置
subscribe.enabled- 是否启用订阅奖励
subscribe.rank- 要赋予玩家的 rank
- 仅在安装了 Vault 和权限插件时生效
- 设置为
'none'可禁用 subscribe.commands- 玩家订阅后执行的命令
subscribe.revoke-commands- 玩家不再订阅后执行的命令
- 这里只支持
%name%占位符
关注奖励配置
follow.enabled- 是否启用关注奖励
follow.rank- 要赋予玩家的 rank
follow.commands- 玩家关注后执行的命令
follow.revoke-commands- 玩家取消关注后执行的命令
可用占位符
%name%- 完成订阅的玩家名称%channel%- 该订阅关联的频道名称%channelid%-%channel%对应的频道 id
依赖要求
- 如需发放 rank,你需要安装:
Vault- 一个 permissions plugin
命令
/twitchsync- 不接受任何参数
开发者
- 插件提供两个事件:
PlayerSubscriptionEventPlayerFollowEvent- 它们都继承自
PlayerEvent - 并额外提供一个名为
getChannelId()的方法
常见问题与问题反馈
- 如果你遇到任何问题,请加入作者的
Discord - 反馈问题前,请务必:
- 在配置文件中启用
debug-mode - 提供你的控制台输出
- 提供你的配置文件
注意事项
redirect-uri必须与 Twitch 后台设置完全一致,否则验证可能失败- 如果启用了订阅或关注奖励中的其中一项,建议相应修改
messages.not-both的内容,以便向玩家清楚说明当前只能获得哪一类奖励 - 如果出现
"An unknown error occurred. Please try again.",可先多尝试几次;若仍失败,再开启debug-mode进行排查
测试支持版本
版本分布
基本信息
插件名称
TwitchSync
作者
Okx
平台
Bukkit / Spigot
支持版本
1.7 - 1.14
点赞数
1
最近版本
1.4.2
1