For plugin developers
VF Dungeons API
Bukkit events for your own plugins from VF Dungeons runs: runs, checkpoints and downs, mobs and bosses, entry checks, loot, lockouts and records.
VF Dungeons calls an event whenever something happens in a dungeon run. Your plugin listens to them like any other Bukkit event, to give out rewards, keep stats, post to Discord, or change what happens. The plugin carries the API itself, so servers need nothing extra.
Add it to your plugin
The API is on Voxelforge's own Maven repository. Compile against it, but don't shade it in: VF Dungeons provides it at runtime.
Maven
<repository>
<id>voxelforge</id>
<url>https://voxelforge.app/maven/</url>
</repository>
<dependency>
<groupId>com.voxelforge</groupId>
<artifactId>voxelforge-adventure-api</artifactId>
<version>1.3.0</version>
<scope>provided</scope>
</dependency>Gradle (Kotlin)
repositories {
maven("https://voxelforge.app/maven/")
}
dependencies {
compileOnly("com.voxelforge:voxelforge-adventure-api:1.3.0")
}In your plugin.yml (or paper-plugin.yml), add softdepend: [VFDungeons], or depend if your plugin needs it to run.
Listening
import com.voxelforge.adventure.api.event.BossDefeatEvent;
import com.voxelforge.adventure.api.event.DungeonRunEndEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public final class Rewards implements Listener {
@EventHandler
public void onRun(DungeonRunEndEvent e) {
if ("cleared".equals(e.getResult())) {
e.getPlayers().forEach(p -> p.sendMessage("You cleared " + e.getPlaceName() + "!"));
}
}
@EventHandler
public void onBoss(BossDefeatEvent e) {
e.getDamageShares().forEach((player, share) -> {
// Pay out by each player's share of the fight.
});
}
}Every event has getWorld() and getPlaceName() (the dungeon's name). Events about a player have getPlayer(). Ids are the ones the editor gives, such as mob-3, as in the dungeon file. All events are called on the main thread.
Events
Mobs and bosses
| Event | When | What it has |
|---|---|---|
MobTypeSpawnEvent | One of the dungeon’s own mob types spawned. | getEntity() the mobgetMobType() "mob-3"isBoss() |
MobTypeDeathEvent | One of them died. | getEntity()getMobType()getKiller() a player, or null |
MobMoveEvent | A mob type is about to use a skill or own move on a player. Cancel it and it doesn’t (it tries another, or waits). | getSkill() "move", "charge", "fireball"…getMove() the skill’s id, or the move’s namegetTarget() the player |
BossPhaseEvent | A boss reached one of its phases. | getPhase() from 1getAtPercent() the health % it starts at |
BossDefeatEvent | A boss died. | getKiller()getDamageShares() each player’s share of the damage, by UUID, 0 to 1 |
Runs
| Event | When | What it has |
|---|---|---|
DungeonRunStartEvent | A dungeon run began. | getPlayers()getRunId()getTier() the tier's id: normal, hard, mythic… (1.2.0) |
DungeonRunEndEvent | A dungeon run ended. | getPlayers()getResult() cleared, failed, timeout or abandonedgetTier() the tier's id: normal, hard, mythic… (1.2.0) |
DungeonCheckpointEvent | The party reached a checkpoint, walking in or by a rule: their respawn point from now on. (1.3.0) | getRunId()getTier()getPlayers() the party onlinegetPlayer() who walked in, or null for a rulegetCheckpointId() "checkpoint-2"getCheckpointName() as players see it |
DungeonPlayerDownEvent | A player went down, or died under the server’s own rules on death (the down counts either way). (1.3.0) | getRunId()getTier()getPlayer()isDeath() a real death, not a downgetLivesLeft() -1 in a dungeon without livesisOut() out of lives: they only watch now |
DungeonWipeEvent | Nobody in the run is left standing: the party starts again from its checkpoint, or the run fails. (1.3.0) | getRunId()getTier()getPlayers()getCheckpointName() where they start againisRunOver() everyone is out of lives: a DungeonRunEndEvent follows |
DungeonLeaveEvent | A player left a run before it was over (not called when the run ends for everyone). (1.3.0) | getRunId()getTier()getPlayer()getReason() leave, party, offline, kicked or other |
SignalEvent | A signal was sent. | getName()getPlayer() or null |
Entry, loot and records
| Event | When | What it has |
|---|---|---|
DungeonEntryCheckEvent | A party is checked for a tier, after VF Dungeons’ own checks (permission, key, money, level, entry cooldown) have passed: as the tier picker or an entrance shows it, as they queue, and again as the run starts. (1.3.0) Keep them out with deny(reason): players see the reason. | getLeader()getPlayers() the leader firstgetTier()getStage() pick, queue or start |
DungeonLootRollEvent | A chest or a boss rolled its loot for a player (or for the party, at a shared chest), the tier’s extra loot included. (1.3.0) Change the list to change what they get, or cancel it and they get nothing from this roll. | getRunId()getTier()getPlayer() null at a shared chestgetSource() chest or bossgetSourceId() "chest-3", "mob-2"getItems() a list you can change |
DungeonLockoutEvent | A player is about to be locked out of a chest’s or boss’s loot until the reset, or to wait before playing a tier again after a clear. (1.3.0) Change when it ends with setUntil, or cancel it. | getPlayer()getTier()getKind() loot or cooldowngetSource() "chest:chest-3", "boss:mob-2", or null for a cooldowngetUntil() when it ends, epoch milliseconds |
DungeonRecordEvent | A finished run was written to the server’s records, whatever its result. Soon after DungeonRunEndEvent. (1.3.0) | getRunId()getTier()getPlayers() UUIDs, online or notgetNames() in the same ordergetResult() cleared, failed, timeout or abandonedgetMillis() how long it tookisBest() this server’s fastest clear of that dungeon and tier yet |
LootBoxOpenEvent | A player opened a loot box or crate and won a prize, not yet given. Change the prize with setPrize, or cancel it (a crate keeps its key). | getBoxId()isCrate()getRarity()getPrize() |
Group finder
| Event | When | What it has |
|---|---|---|
DungeonQueueJoinEvent | A player, or a party’s leader for the party, joins the group finder’s queue. Cancel it and they don’t (tell them why: the finder says nothing more). | getPlayers() the player, or the party, its leader firstgetDungeons() the dungeons they’d go to, each tier on its own: "Crypt · Hard"isAnyInRange() they asked for any dungeonisFullGroupsOnly() they wait for four |
DungeonGroupFormEvent | The group finder made a group: everyone said yes to the ready check, and they’re on their way in as a party. | getPlayers() its leader firstgetDungeon() its name, with the tier: "Crypt · Hard"isShortHanded() under four players |
Changing what happens
- Cancel a mob's move, a loot box's prize, a player joining the group finder's queue, a loot roll or a lockout with
setCancelled(true). - Keep a party out of a tier with
DungeonEntryCheckEvent.deny("…"). Players see your reason in the tier picker, the group finder or chat. - Change a loot box's prize with
LootBoxOpenEvent.setPrize, a roll's items throughDungeonLootRollEvent.getItems(), and when a lockout or cooldown ends withDungeonLockoutEvent.setUntil(now or earlier: none). - Everything else reports what has already happened.
Coming during the beta: quest and conversation events, with run quests and talking NPCs. After it: a way for your plugin to add its own actions and conditions, which the editor then offers as blocks. Tell us what you'd use it for in the beta.