Developer API
Developer API
BusyMining exposes a small API for other plugins. There's no published Maven artifact yet, so
compile against the BusyMining jar as a provided/compileOnly dependency and add BusyMining to
depend or softdepend in your plugin.yml.
Getting the API
BusyMiningAPI api = BusyMining.getAPI();
BusyMining is net.busybee.busyMining.BusyMining; the API interface is
net.busybee.busyMining.api.BusyMiningAPI. getAPI() returns null until BusyMining has finished
enabling.
Methods
| Method | Returns |
|---|---|
getPlayerData(Player) |
CompletableFuture<PlayerData>: completes straight away for online players, otherwise loads from the database |
getMiningLevel(Player) |
Mining level |
getZeta(Player) |
Zeta balance |
addZeta(Player, int) |
Adds exactly that much Zeta (no perk bonuses). Works for offline players |
addMiningXP(Player, int) |
Adds mining XP, levelling the player up as needed. Works for offline players |
getSingularityLevel(Player) |
Singularity level |
getOraclesKilled(Player) |
Oracles killed |
Reads and writes go through BusyMining's cache for online players, so they're safe to call from the
player's own thread. For a player who isn't loaded, the plain getters wait on the database, so don't
call them for offline players from a server or region thread; use getPlayerData instead.
Events
net.busybee.busyMining.api.event.ArtifactIdentifyEvent fires when a player collects a
finished item from the Artifact Identifier.
| Getter | Value |
|---|---|
getPlayer() |
The player |
getArtifactName() |
"Artifact" or "Fossil" |
getTier() |
The artifact tier (COMMON ... DIVINE), or the fossil species (DRAGON, PHOENIX, MANTICORE, WRAITH) |
net.busybee.busyMining.modules.EnchantmentModule.ExtraBlockBreakEvent extends
BlockBreakEvent and fires for every extra block broken by Explosive, Vein Miner or Sonic.
Cancelling it keeps that block. Check EnchantmentModule.isExtraBreak(event) in your own
BlockBreakEvent listener if you need to tell these apart from normal breaks.
Custom items
BusyMining items carry the persistent data key busymining:item_id (a string) holding their
/mine give id. For item families it's just the family name:
gemstone, not gemstone:3. Mining Tomes and items made by very old versions don't carry it.