Skip to content

Velocity EN

sqkl520 edited this page Nov 28, 2026 · 2 revisions

Velocity Networks

简体中文 | English

Running several Paper backends behind a Velocity proxy, sharing one MySQL database. The plugin supports this setup, but a few behaviours need to be known up front.


What it does

Three things are implemented over the BungeeCord plugin messaging channel (Velocity is backwards compatible with that protocol):

Feature Subchannel Trigger
Network-wide announcement GlobalMessage /lea broadcast <message>
Achievement unlock announcement AchievementUnlock Automatically when a player unlocks one
Season events SeasonSettled / SeasonStarted Season settlement and season start

The channel name is fixed at BungeeCord. The plugin registers both inbound and outbound directions on startup and logs Proxy messaging channel registered (Velocity/BungeeCord compatible).


Required configuration

1. MySQL, not SQLite

SQLite is a single-machine file. Several backends writing their own copies will overwrite each other. database.type must be mysql, and every backend must point at the same database.

2. Identical clocks on every backend

Season windows are derived from "anchor date + fixed duration" at local-day granularity. A timezone mismatch shifts the boundaries; the worst case is one server paying out twice while another gets an empty season.

timedatectl
#   Time zone: Asia/Shanghai (CST, +0800)
#   System clock synchronized: yes

season.anchor-date must be identical in every backend's config.yml.

3. Give each backend its own proxy.server-name

proxy:
  server-name: "survival"   # must match the server name in your Velocity config

This value is used for loop suppression: season broadcasts carry the sender's name, and a receiver that sees its own name skips the message. Left empty, suppression degrades to "may announce twice"; reward payment is still protected by ledger idempotency, so money is never paid twice.

4. Set proxy.inbound-secret — strongly recommended

proxy:
  inbound-secret: "a random string, identical on every backend"

This is the easiest thing to overlook. Bukkit dispatches "plugin messages forwarded by the proxy" and "custom payloads sent by any player's client" to the same callback, and the callback carries no source information. A player with a modified client can therefore forge any of these frames, with the same effect as a real backend sending them:

Forged subchannel Consequence
GlobalMessage Broadcast arbitrary text network-wide, disguised as an owner announcement
AchievementUnlock Grant any achievement to any player name and announce it
SeasonSettled Trigger season reward payout and a "season ended" broadcast

With a secret configured, the sender prepends an HMAC signature to the whole frame and the receiver verifies it before parsing. Unsigned forged frames are dropped before they are ever parsed.

Empty (the default) means no verification, matching the behaviour before this key existed — fine for a single server. On a multi-server network, leaving it empty hands broadcast rights to anyone with a modified client.


Which backends should enable the feature

server.enabled is a whole-server switch, not a feature switch.

server:
  enabled: false   # this backend does not offer the English learning feature

When off, the plugin does not construct any managers, register listeners, schedule tasks, or register the proxy channel. Only config, messages, the database connection, and command registration remain (the commands refuse based on this value; /lea reload is the exception and still works).

Use it when you run several backends under one proxy but only one or two should offer English learning; the rest can carry the plugin for shared config or to avoid errors.

Note the difference from module switches like word-system.enabled: those are feature-level (entry hidden, events silenced, data retained), while server.enabled does not even install listeners and tasks. A single-server deployment can use it as a one-switch silence too.

Changing it requires a restart: the full off → on / on → off transition needs a server reload, not just /lea reload.


A limitation you must know: there is no cross-server cache invalidation

The plugin has no mechanism to invalidate caches across servers. If server A changes data, server B's in-memory cache will not know.

What that means in practice:

Data Behaviour
Leaderboard caches Each refreshes on its own 5-minute cycle; two backends may show different rankings, off by up to 5 minutes
%lle_rank% / %lle_coins_earned% Independent 30-second TTLs, not synchronised across servers
Player data Cleared locally when a player leaves, reloaded from the database on arrival, so switching servers does not read stale data

Do not assume two backends show identical leaderboards in real time. If a display requires strict consistency, show leaderboards on one backend only, or accept up to 5 minutes of lag.


How broadcast actually behaves

/lea broadcast has several constraints:

  1. At least one online player is required as a messenger. Bukkit plugin messages must travel over a player connection, so an empty server cannot send. The command then reports "Proxy messaging is not available. This server must be running behind Velocity or BungeeCord." rather than pretending to succeed.
  2. Payload limit is 30000 bytes, measured in writeUTF terms. Longer messages are truncated with a WARNING in the log.
  3. Nothing sends when the channel is not registered. On a standalone server there is no proxy, registration is skipped silently, and broadcast reports the same error.

Troubleshooting

Symptom Check
No Proxy messaging channel registered in the log The server is not behind a proxy, or the proxy is not forwarding the BungeeCord channel
Broadcast reports proxy-unavailable No players online to act as messenger, or the channel is not registered
Achievement announcements repeat across servers proxy.server-name is missing or wrong, so loop suppression fails
Season rewards do not pay out on one backend Check that backend's clock and season.anchor-date
Someone forged an announcement Check that proxy.inbound-secret is set and identical on every backend

See also

Clone this wiki locally