Networks and storage¶
One server¶
Nothing to do. Votes, totals, streaks and points live in
plugins/EmberVoting/votes.yml, and votes owed to offline players in
queue.yml.
A network¶
A vote site can only be pointed at one address, so one server receives every vote. The rest have to hear about it somehow. Ember Voting does that through a shared database rather than a proxy plugin, which means it also works for servers that are not behind your proxy at all.
Give every server the same database and a different name:
storage:
type: mysql
mysql:
host: 10.0.0.5
port: 3306
database: minecraft
user: mc
password: "secret"
prefix: ev_
ssl: false
network:
enabled: true
server-name: survival # different on each server
poll-seconds: 2
Then point the vote sites at whichever server you like - usually the lobby, because it is the one that is always up.
What happens on a vote¶
- The receiving server verifies it, counts it, and writes it to a shared log with the totals it just computed.
- Every other server reads that log every couple of seconds.
- The server where the player is actually standing pays the rewards. Nobody is paid twice, and nobody is missed.
- All servers broadcast it, so the whole network sees the same message.
- The vote party bar is shared, so a party fills from votes anywhere and fires everywhere.
- At the turn of the month, exactly one server crowns the top voter, decided by the database rather than by luck.
If the player is offline everywhere, the vote is queued once and paid at their next login on any server.
The tables are created on first start, all prefixed ev_, so the database can
be shared with other plugins. The MySQL driver is downloaded by the server
itself the first time the plugin loads; nothing is bundled in the jar.
If MySQL is not reachable¶
The plugin says so in the console, falls back to the local YAML file for that session, and keeps receiving votes. Network sync stays off until MySQL works again. A vote is never lost because of a database.
Changing storage later¶
Storage is read at startup, so a change to storage.type needs a restart, not
a reload. Data is not migrated between the two: switch before you have history
you care about, or accept the reset.
Does this need Ember Bridge?¶
No. Ember Bridge carries Ember Essentials traffic between servers on its own protocol; Ember Voting uses the database. They coexist happily and neither needs the other.