Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 82
Release baseline: The signatures and source links on this page target VotingPlugin 7.1.1. The hosted Javadocs and
mastersource can include unreleased 7.1.2-SNAPSHOT changes. VotingPlugin 7.1.1 requires Java 21.
VotingPlugin exposes user, vote-site, command, reward-extension, and event APIs for Bukkit plugins.
Add VotingPlugin as a dependency or soft dependency in your plugin metadata before accessing it.
VotingPluginMainplugin = (VotingPluginMain) Bukkit.getPluginManager()
.getPlugin("VotingPlugin");
if (plugin == null || !plugin.isEnabled()) {
return;
}
VotingPluginHookshooks = VotingPluginHooks.getInstance();
UserManageruserManager = hooks.getUserManager();Release 7.1.1 VotingPluginHooks methods include:
| Method | Purpose |
|---|---|
getMainClass() | Returns the current VotingPluginMain instance |
getUserManager() | Returns VotingPlugin's user manager |
backgroundUpdate(Player) | Runs the user's vote/offline-reward update |
addCustomReward(RewardInject) | Registers a custom AdvancedCore reward |
addCustomRequirement(RequirementInject) | Registers a custom reward requirement |
See VotingPluginHooks.java at 7.1.1 for the released contract.
VotingPluginUserbyPlayer = plugin.getVotingPluginUserManager()
.getVotingPluginUser(player);
VotingPluginUserbyName = plugin.getVotingPluginUserManager()
.getVotingPluginUser("BenCodez");
VotingPluginUserbyUuid = plugin.getVotingPluginUserManager()
.getVotingPluginUser(uuid);Common point operations include:
intpoints = byPlayer.getPoints();
byPlayer.setPoints(100);
byPlayer.addPoints(10);
byPlayer.removePoints(5);Do not perform blocking database work on the Bukkit main thread. Use the plugin's existing APIs and scheduler expectations when working with uncached users.
VoteSite is in com.bencodez.votingplugin.votesites.
VoteSitesite = plugin.getVoteSite("ExampleSite", true);
if (site != null) {
site.giveRewards(user, user.isOnline(), false);
}The second getVoteSite argument controls whether disabled sites are filtered out. Reward delivery also needs the correct online and proxy/Bungee context; do not blindly copy the example when processing a real vote.
VotingPlugin uses AdvancedCore's CommandHandler. Pass the plugin instance to the released constructor:
plugin.getVoteCommand().add(newCommandHandler(
plugin,
newString[] { "Example", "(player)" },
"myplugin.command.example",
"Run the example command"
) {
@Overridepublicvoidexecute(CommandSendersender, String[] args) {
if (args.length < 2) {
return;
}
sender.sendMessage("Example command for " + args[1]);
}
});Use plugin.getAdminVoteCommand() to add an /adminvote (/av) subcommand. For production code, validate argument counts, console access, permissions, and player lookup behavior.
Released examples are available in CommandLoader.java at 7.1.1.
Register listeners through Bukkit's normal event system:
@EventHandlerpublicvoidonVote(PlayerPostVoteEventevent) {
getLogger().info(event.getPlayerName() + " voted on " + event.getService());
}VotingPlugin 7.1.1 event classes include:
| Event | When it is used |
|---|---|
PlayerVoteEvent | A vote enters VotingPlugin processing; exposes vote, total, broadcast, and cancellation controls |
PlayerPostVoteEvent | Vote processing has reached the post-vote stage |
PlayerReceivePointsEvent | Vote points are about to be applied; exposes points and cancellation controls |
PlayerSpecialRewardEvent | A VotingPlugin special reward is processed |
PlayerVoteCoolDownEndEvent | A player's overall voting cooldown becomes available |
PlayerVoteSiteCoolDownEndEvent | A specific vote site's cooldown becomes available |
VotePartyEvent | A vote party is triggered |
VoteMilestoneRewardEvent | A VoteMilestone reward completes successfully |
VoteShopPurchaseEvent | A player attempts a VoteShop purchase |
Use the 7.1.1 events source directory as the release-authoritative list. AdvancedCore also publishes reward and lifecycle events; check the exact dependency version before depending on one.
- Compile against the VotingPlugin and AdvancedCore versions you support.
- Treat source and Javadocs for that exact version as authoritative.
- Use soft dependency handling if your plugin can operate without VotingPlugin.
- Avoid reflection when a public API is available.
- Test integrations with both cached/offline votes and normal online votes.
- Vote Milestones
- Vote Streak System
- Vote Reminders — Current System
- Legacy Vote Reminding
- Vote Broadcast System
- Vote Logging
- Webhooks
- Time Changes
- Month Date Totals
- VoteShop
- Rewards Overview — Start Here
- Special Rewards
- Reward System Concepts
- Reward File Format
- Where to Set Rewards
- All Reward Possibilities
- AdvancedPriority Rewards
- Reward Examples
- Delayed Reward Command
- World Example
- VotingPlugin-Specific Rewards
- Commands & Permissions
- Signs
- API
- PlaceholderAPI Placeholders
- Minecraft Server Lists
- Bedrock Player Support
- Transferring Data Storage