
Skript 的跨服务器变量:在 BungeeCord 或 Velocity 网络中的所有服务器上保持同步的共享、全局变量,以及从代理服务器共享脚本。作为 Skungee 的替代方案。
# 在大厅服务器
set {?coins::%player%} to 100
# 在生存服务器,无需额外代码即可立即生效
send "You have %{?coins::%player%}% coins"
任何以 ? 开头的变量都是网络变量。读取操作来自当前服务器的本地副本,因此只有写入操作会通过网络传输。
阅读 Wiki 以获取设置指南、完整的语法参考和可复制的示例脚本。
功能
- 共享变量。 任何
{?variable} 在所有服务器上实时可用。
- 免费读取。 数据来自本地内存。只有写入操作会通过网络传输。
- 原子性变更。
add(增加)、remove(减少)、set if not set(若未设置则设置)、set if it is(若存在则设置)。这些操作在代理端处理,因此当两个服务器竞争时不会丢失数据。
- 支出下限。
without going below 0 会在值低于 0 时拒绝操作,而不是允许负数。
- 读取结果。
and wait 返回新值,或者说明被拒绝的原因。
- 服务器标识。
network server name,用于编写可在所有服务器运行的通用脚本。
- 同步状态。
network is synced(网络已同步)、on network sync(网络同步时触发)、on network disconnect(网络断开连接时触发)。
- 变更事件。
on network variable change of "coins::*" 在所有服务器上触发,并提供旧值和新值。
- 玩家位置。
all network players(所有网络玩家)、network server of "Notch"(Notch 所在的服务器)、network server "survival" is online(生存服务器在线),以及任意服务器的 motd、版本、玩家上限和白名单。数据来自内存,并由代理服务器保持最新。
- 随处发送消息。
send network message 和 send network action bar 可向任意服务器上的玩家发送消息,broadcast ... across the network 向全网广播。
- 移动玩家。
connect network player "%player%" to "survival"。
- 远程控制台。
execute command ... on network server "survival"。除非代理配置允许,否则默认关闭。
- 脚本共享。 从代理服务器推送脚本,并显示每个服务器的加载结果。
- 重启后存活。 采用仅追加日志,支持自动压缩,重新连接后可恢复。
- 兼容 BungeeCord 和 Velocity。 同一个 jar 包,同一套配置文件。
要求
|
最低版本 |
推荐版本 |
| Java |
25 |
25 |
| Minecraft |
1.21 至 26.2 |
26.1.2 |
| Skript |
2.16.0+ |
2.16.2 |
| 代理 |
BungeeCord 或 Velocity |
均可 |
必须使用 Java 25。 如果在 Java 21 或更低版本上运行,该 jar 包将无法加载,无论你使用的是哪个 Minecraft 版本。这两条规则同时适用:即使是 1.21 版本的服务器,也必须使用 Java 25 启动。
每个游戏服务器和代理服务器都运行相同的 jar 包。如果某个服务器版本落后,它将在连接时被拒绝,并在两个控制台中显示消息提示哪一侧需要更新。
支持离线模式服务器。skNetwork 从不检查玩家身份。
已在 Minecraft 1.21.11 和 26.1.2、Skript 2.16.2、BungeeCord 26.1 和 Velocity 4.1.1 上测试通过。
命令
/sknet 状态、代理信息、缓存大小、延迟
/sknet resync 丢弃副本并重新拉取所有数据
/sknet reconnect 断开连接并从断点继续
/sknetproxy 代理信息:状态、后端节点、变量数量
/sknetproxy push 代理:立即发送脚本
/sknetproxy dump <pattern> 代理:查找变量,'*' 为通配符
/sknetproxy log 代理:存储大小、压缩时间和刷新时间
/sknetproxy compact 代理:立即重写日志
/sknetproxy backup 代理:将日志复制到 backup/ 目录并添加时间戳
/sknetproxy reload 代理:重新读取 config.yml,应用可移动的更改
这两组命令故意使用不同的名称。代理会优先处理它知道的命令,因此在游戏服务器看到之前先由代理拦截。保留 /sknet 专供游戏服务器使用,意味着它总是能到达你当前所在的服务器,而在那里拥有操作员权限就足够了。
/sknet 也响应 /sknetlocal 和 /sknl,/sknetproxy 响应 /sknetp 和 /sknp。两者都需要 sknetwork.admin 权限。两个 config.yml 文件支持的所有选项均在 配置 Wiki 页面 中列出。
链接



skNetwork 使用 bStats 收集匿名使用统计数据。你可以在 plugins/bStats/config.yml 中选择退出。
Bukkit / Spigot / Paper
BungeeCord
Velocity
设置、配置和完整的语法参考请参见
Wiki。

Cross-server variables for Skript: shared, global variables that stay in sync
across every server on a BungeeCord or Velocity network, plus script sharing from the proxy. A Skungee alternative.
# on the lobby
set {?coins::%player%} to 100
# on survival, straight away, no extra code
send "You have %{?coins::%player%}% coins"
Any variable starting with ? is a network variable. Reads come from this
server's own copy, so only writes go over the wire.
Read the wiki for setup, guides,
the full syntax reference and copyable example scripts.
Features
- Shared variables. Any
{?variable} is live on every server.
- Free reads. Served from local memory. Only writes cross the wire.
- Atomic changes.
add, remove, set if not set, set if it is. Worked out
on the proxy, so nothing is lost when two servers race.
- A spend floor.
without going below 0 refuses instead of going negative.
- Read the outcome.
and wait gives you the new value, or why it was refused.
- Server identity.
network server name, for one script that runs everywhere.
- Sync state.
network is synced, on network sync, on network disconnect.
- Change events.
on network variable change of "coins::*" fires on every server
with the old and the new value.
- Who is where.
all network players, network server of "Notch",
network server "survival" is online, plus the motd, version, player limit and
whitelist of any server. Read from memory, kept fresh by the proxy.
- Messages anywhere.
send network message and send network action bar to a
player on any server, broadcast ... across the network to everyone.
- Moving players.
connect network player "%player%" to "survival".
- Remote console.
execute command ... on network server "survival". Off until
the proxy config allows it.
- Script sharing. Push scripts from the proxy, with per-server load results.
- Survives restarts. Append-only log, self-compacting, reconnects resume.
- BungeeCord and Velocity. Same jar, same config.
Requirements
|
Works with |
Recommended |
| Java |
25 |
25 |
| Minecraft |
1.21 to 26.2 |
26.1.2 |
| Skript |
2.16.0+ |
2.16.2 |
| Proxy |
BungeeCord or Velocity |
either |
Java 25 is required. The jar will not load on Java 21 or older, whatever Minecraft
version you run. Both rules apply together: a 1.21 server also has to be started with
Java 25.
Every game server and the proxy run the same jar. One that is behind is refused
when it connects, with a message on both consoles saying which side to update.
Works on offline servers. skNetwork never looks at player identity.
Tested on Minecraft 1.21.11 and 26.1.2, Skript 2.16.2, BungeeCord 26.1 and
Velocity 4.1.1.
Commands
/sknet state, proxy, copy size, latency
/sknet resync throw the copy away and pull everything again
/sknet reconnect drop the connection and continue where it stopped
/sknetproxy proxy: state, backends, variable count
/sknetproxy push proxy: send scripts now
/sknetproxy dump <pattern> proxy: look up variables, '*' is a wildcard
/sknetproxy log proxy: storage size, compaction and flush times
/sknetproxy compact proxy: rewrite the log now
/sknetproxy backup proxy: timestamped copy of the log into backup/
/sknetproxy reload proxy: re-read config.yml, apply what can move
The two halves use different names on purpose. A proxy handles any command it knows
before the game server sees it, so keeping /sknet free means it always reaches the
server you are standing on, where being an operator is already enough.
/sknet also answers to /sknetlocal and /sknl, /sknetproxy to /sknetp and
/sknp. Both need sknetwork.admin. Every option the two config.yml files take is
on the Configuration wiki page.
Links



skNetwork uses bStats for anonymous usage stats. You can opt out in plugins/bStats/config.yml.
Bukkit / Spigot / Paper
BungeeCord
Velocity
Setup, config and the full syntax reference are in the
wiki.
评论 0
登录后参与评分
还没有评论,来抢沙发吧