A secure vote listener plugin for Hytale that enables voting sites to send vote notifications to your server.
A secure vote listener plugin for Hytale that enables voting sites to send vote notifications to your server.
Hyvote.jar in your server's plugins foldersettings.json will be generated automaticallykeys/public.pem)Settings are stored in settings.json:
{
"port": 2250,
"database": {
"type": "sqlite",
"host": "localhost",
"port": 3306,
"username": "hytale",
"password": "supersecretdatabasepassword",
"database": "hyvote"
},
"actions": [
{
"on": "vote",
"type": "command",
"command": "say ${player} just voted on ${voteSite}!"
},
{
"on": "join",
"type": "command",
"command": "say Welcome back ${player}! Thanks for voting on ${voteSite}"
}
]
}port: The TCP port the vote listener binds to (default: 2250)
database: The configuration options for the database
actions: Array of actions to execute when votes are received
Databases are used to track which nonces have been used and deliver votes for actions that require the user to be online but are recieved when offline.
#### Action Properties
vote - Immediately after vote is processedjoin - When the player joins (or immediately if already online)command is supported)${player} - The voter's username${voteSite} - The name of the voting site${uuid} - The voter's UUID${timestamp} - Vote timestampHyvote provides an event system for plugin developers to integrate custom vote handling.
import uk.co.deveroonie.hyvote.api.VoteEventManager;
import uk.co.deveroonie.hyvote.api.VoteReceivedEvent;
// Register your listener
VoteEventManager.registerListener(event -> {
Vote vote = event.getVote();
// Access vote data
String player = vote.playerName;
String site = vote.voteSite;
long timestamp = vote.timestamp;
// Optionally cancel default processing
event.setCancelled(true);
// Implement your custom logic
myPlugin.giveCustomReward(player);
});public class Vote {
public String uuid; // Player UUID
public String playerName; // Player username
public String voteSite; // Voting site identifier
public long timestamp; // Unix timestamp
public String nonce; // Replay protection nonce
}VoteListener myListener = event -> { /* ... */ };
VoteEventManager.registerListener(myListener);
// Later...
VoteEventManager.unregisterListener(myListener);Hyvote uses a custom binary protocol (HV01) for vote transmission:
[4 bytes] Magic: "HV01"
[4 bytes] Encrypted AES key length (big-endian int)
[N bytes] RSA-encrypted AES-256 key
[4 bytes] Encrypted payload length (big-endian int)
[M bytes] AES-encrypted JSON payload{
"uuid": "player-uuid-here",
"playerName": "PlayerName",
"voteSite": "VotingSiteName",
"timestamp": 1737000000000,
"nonce": "unique-random-string"
}Official client libraries coming soon for:
For issues, feature requests, or protocol questions, please visit our GitHub repository.
MIT
0 Comments