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.0") }

Available Methods

MethodReturnDescription
claimForPlayer(String)CompletableFuture<List<Vote>>Claims all unclaimed votes for a player
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

Example: Claim on Player Join

Automatically claim any pending votes when a player joins:

java
@EventHandler public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); VotePipe.claimForPlayer(player.getName()) .thenAccept(votes -> { if (!votes.isEmpty()) { for (Vote vote : votes) { giveReward(player, vote); } player.sendMessage("You received " + votes.size() + " vote reward(s)!"); } }) .exceptionally(error -> { getLogger().warning("Failed to claim votes: " + error.getMessage()); return null; }); }

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

Next Steps