Voxelforge
← VF Dungeons

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

EventWhenWhat it has
MobTypeSpawnEventOne of the dungeon’s own mob types spawned.getEntity() the mob
getMobType() "mob-3"
isBoss()
MobTypeDeathEventOne of them died.getEntity()
getMobType()
getKiller() a player, or null
MobMoveEventA 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 name
getTarget() the player
BossPhaseEventA boss reached one of its phases.getPhase() from 1
getAtPercent() the health % it starts at
BossDefeatEventA boss died.getKiller()
getDamageShares() each player’s share of the damage, by UUID, 0 to 1

Runs

EventWhenWhat it has
DungeonRunStartEventA dungeon run began.getPlayers()
getRunId()
getTier() the tier's id: normal, hard, mythic… (1.2.0)
DungeonRunEndEventA dungeon run ended.getPlayers()
getResult() cleared, failed, timeout or abandoned
getTier() the tier's id: normal, hard, mythic… (1.2.0)
DungeonCheckpointEventThe party reached a checkpoint, walking in or by a rule: their respawn point from now on. (1.3.0)getRunId()
getTier()
getPlayers() the party online
getPlayer() who walked in, or null for a rule
getCheckpointId() "checkpoint-2"
getCheckpointName() as players see it
DungeonPlayerDownEventA 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 down
getLivesLeft() -1 in a dungeon without lives
isOut() out of lives: they only watch now
DungeonWipeEventNobody 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 again
isRunOver() everyone is out of lives: a DungeonRunEndEvent follows
DungeonLeaveEventA 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
SignalEventA signal was sent.getName()
getPlayer() or null

Entry, loot and records

EventWhenWhat it has
DungeonEntryCheckEventA 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 first
getTier()
getStage() pick, queue or start
DungeonLootRollEventA 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 chest
getSource() chest or boss
getSourceId() "chest-3", "mob-2"
getItems() a list you can change
DungeonLockoutEventA 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 cooldown
getSource() "chest:chest-3", "boss:mob-2", or null for a cooldown
getUntil() when it ends, epoch milliseconds
DungeonRecordEventA finished run was written to the server’s records, whatever its result. Soon after DungeonRunEndEvent. (1.3.0)getRunId()
getTier()
getPlayers() UUIDs, online or not
getNames() in the same order
getResult() cleared, failed, timeout or abandoned
getMillis() how long it took
isBest() this server’s fastest clear of that dungeon and tier yet
LootBoxOpenEventA 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

EventWhenWhat it has
DungeonQueueJoinEventA 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 first
getDungeons() the dungeons they’d go to, each tier on its own: "Crypt · Hard"
isAnyInRange() they asked for any dungeon
isFullGroupsOnly() they wait for four
DungeonGroupFormEventThe 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 first
getDungeon() 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 through DungeonLootRollEvent.getItems(), and when a lockout or cooldown ends with DungeonLockoutEvent.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.

Try it now

Free, in your browser, saved as you go.

Start building, free