Developer API
AstralVote exposes its state through one service hung off the main plugin instance, one custom Bukkit event fired when a vote is received, and a SyncAPI snapshot adapter for the player's vote-reminder preference. There is no static *API façade — external plugins reach everything through the plugin instance.
Plugin handle
Custom Bukkit events
AstralVote fires one custom event, in com.astralrealms.vote.event.
PlayerVoteEvent
Fully qualified name: com.astralrealms.vote.event.PlayerVoteEvent (extends AstralCore's AbstractEvent, constructed with isAsync = true).
Fired by VoteService from its VoteReceivedPacket handler, after the corresponding VoteModel row has been fetched, the player has been found online on this server, NEW_VOTE_RECEIVED has been sent, and the unclaimed-vote/last-vote-time caches have already been updated. Not cancellable — it's a notification, not a gate, and fires async (on the messaging callback thread), not on the main thread.
Getter | Type | Value |
|---|---|---|
|
| The player who voted (must be online on this server for the event to fire at all). |
|
| The vote's raw |
|
| The vote's |
VoteService
Access via plugin.votes(). Owns the in-memory unclaimed-vote and weekly-vote-count caches described in Overview and the reminder/claim flows.
Method | Returns | Use |
|---|---|---|
|
| Populates the weekly-count cache and last-vote-time map for a joining player, then sends |
|
| Fetches (and caches) every unprocessed |
|
| Uncached DB query for votes since the most recent Monday, |
|
| Cached weekly count, |
|
| Cached unclaimed-vote count, |
|
| Runs the full claim flow — see Claiming votes. What the |
|
| Drops the player's cached unclaimed votes, weekly count, and last-vote-times. Called by |
Model classes
VoteModel
The votes table row (@Entity("votes"), shared MySQL database with the standalone master module).
markAsProcessed() sets processed = true; this is what claimVote calls before the batch update.
PlayerVoteTime
In-memory only (not persisted). Tracks, per configured service id, the player's last vote time and last reminder-notify time — the state the cooldown/reminder check in Overview reads.
Cross-server player data
VoteSnapshotAdapter (key astralvote:player_data) is registered with SyncAPI in AstralVote#onEnable, making VotePlayerData a cross-server-synced snapshot for every online player.
create(Player) seeds a new player with voteRemindersEnabled = true. apply(...) is a no-op — the flag has no direct effect on the player beyond gating the reminder checks in VoteService, which read it directly through SyncAPI#findData rather than through any apply-time side effect.
See Actions (which flips this flag) and AstralSync's Adapter Interfaces for the base contract.
Registered actions
AstralVote registers two executable actions into AstralCore's action registry via registerActionGlobally — claim-vote and toggle-votes-reminders. Any plugin's menus, dialogs, or action lists can invoke them by name. See Actions for the full list with their behavior.
Messaging
AstralVote's master module publishes VoteReceivedPacket (a single voteId UUID) on the RabbitMQ exchange astralvote.votes, registered by VotePacketRegistry. The Paper plugin subscribes to that exchange through AstralCore's MessagingService in VoteService's constructor and re-fetches the full VoteModel row by id on receipt — the packet only signals that a new vote exists, it never carries vote data itself.