Skip to content
VotePipe

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

MethodReturnDescription
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()ConnectionStatusCurrent connection state
isConnected()booleanQuick check if connected
isAvailable()booleanCheck if VotePipe API is available
getUnclaimedCount()intGet unclaimed vote count
getClaimedToday()intGet 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:

FieldTypeDefaultDescription
providerStringnullFilter by provider (null = all)
periodPeriodMONTHLYDAILY, WEEKLY, MONTHLY, ALL_TIME
limitint10Max 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

FieldTypeDescription
entriesList<LeaderboardEntry>Ranked list of players
periodStringPeriod used
providerStringProvider filter (null if global)
generatedAtInstantWhen the leaderboard was generated

LeaderboardEntry Object

FieldTypeDescription
rankintPosition (1-based)
playerNameStringPlayer username
voteCountintTotal 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

Next Steps