Plugin API
Programmatic access to VotePipe from your plugin code
Overview
Add VotePipe as a dependency to access these methods from your own plugin. All methods return CompletableFuture for async operation.
groovy
dependencies {
compileOnly("com.mythlane:votepipe:1.0.2")
}Available Methods
| Method | Return | Description |
|---|---|---|
| getUnclaimedVotes() | CompletableFuture<List<Vote>> | Get all unclaimed votes |
| getLeaderboard() | CompletableFuture<Leaderboard> | Get global vote leaderboard |
| getLeaderboard(String) | CompletableFuture<Leaderboard> | Get leaderboard filtered by provider |
| getLeaderboard(Options) | CompletableFuture<Leaderboard> | Get leaderboard with custom options |
| getConnectionStatus() | ConnectionStatus | Current connection state |
| isConnected() | boolean | Quick check if connected |
| isAvailable() | boolean | Check if VotePipe API is available |
| getUnclaimedCount() | int | Get unclaimed vote count |
| getClaimedToday() | int | Get votes claimed today |
| triggerPoll() | CompletableFuture<Void> | Manually trigger a poll |
Example: Get Leaderboard
Fetch and display the global vote leaderboard:
java
VotePipe.getLeaderboard().thenAccept(leaderboard -> {
for (LeaderboardEntry entry : leaderboard.getEntries()) {
System.out.println(entry.getRank() + ". " + entry.getPlayerName() + ": " + entry.getVoteCount());
}
});LeaderboardOptions
Customize leaderboard queries with these options:
| Field | Type | Default | Description |
|---|---|---|---|
| provider | String | null | Filter by provider (null = all) |
| period | Period | MONTHLY | DAILY, WEEKLY, MONTHLY, ALL_TIME |
| limit | int | 10 | Max entries (1-100) |
java
// Get weekly top 20 from Hytale-Servers.pro
LeaderboardOptions options = new LeaderboardOptions()
.provider("hytale-servers-pro")
.period(Period.WEEKLY)
.limit(20);
VotePipe.getLeaderboard(options)
.thenAccept(leaderboard -> {
for (LeaderboardEntry entry : leaderboard.getEntries()) {
System.out.println("#" + entry.getRank() + " " +
entry.getPlayerName() + " - " + entry.getVoteCount());
}
});Leaderboard Response
Leaderboard Object
| Field | Type | Description |
|---|---|---|
| entries | List<LeaderboardEntry> | Ranked list of players |
| period | String | Period used |
| provider | String | Provider filter (null if global) |
| generatedAt | Instant | When the leaderboard was generated |
LeaderboardEntry Object
| Field | Type | Description |
|---|---|---|
| rank | int | Position (1-based) |
| playerName | String | Player username |
| voteCount | int | Total votes in period |
Connection Status
java
if (VotePipe.isConnected()) {
sender.sendMessage("§aVotePipe is connected!");
} else {
ConnectionStatus status = VotePipe.getConnectionStatus();
sender.sendMessage("§cVotePipe is " + status.name().toLowerCase());
}Connection status values: CONNECTED,INTERMITTENT,DISCONNECTED,NEVER_CONNECTED