ALB Studio

Skyblock API

Use SkyblockAPI from your own plugin to check island protection, find islands and their people, and use the island bank, levels and payments.

Docs updated · What changed

On this page

What it is forLink to this section

SkyblockAPI lets other plugins talk to ALBSkyblock: shops, quests, minions, custom items, anything that needs to know about islands. With it you can:

  • ask if a player may build, break or use something at a spot,
  • find the island at a location, or the island of a player,
  • see who is the owner, a team member or trusted,
  • use the island bank and island levels,
  • sell things safely to islands.

It is one static object, com.aayan.albskyblock.api.SkyblockAPI, and it works the same from Kotlin and Java: SkyblockAPI.canBuild(player, location). To react to things that happen on islands, listen to the island events.

Writing a feature for /is itself (a subcommand, a menu)? Write an addon instead. Addons can use this API too.

Add ALBSkyblock to your pluginLink to this section

plugin.ymlLink to this section

plugin.yml
name: MyQuests
version: '1.0.0'
main: com.example.quests.MyQuests
api-version: '26.3'
depend: [ALBCore]
softdepend: [ALBSkyblock]
  • Use softdepend when your plugin also works without islands. Use depend: [ALBCore, ALBSkyblock] when it can't work without them.
  • Both make Paper start ALBSkyblock before your plugin, so the API is ready in your onEnable.
  • List ALBCore too. ALBSkyblock runs on ALBCore's Kotlin runtime, and some of its types (like ItemRef) come from ALBCore.

GradleLink to this section

ALBSkyblock is not in a Maven repository. Copy the ALBSkyblock jar your server runs into your project's libs/ folder, and compile against it:

build.gradle.kts
dependencies {
    compileOnly("io.papermc.paper:paper-api:26.3.build.252-stable")
    compileOnly(files("libs/ALBSkyblock.jar"))
    compileOnly("com.aayan:alb-core:1.5.0")
    compileOnly(kotlin("stdlib"))   // ALBCore ships the Kotlin runtime: never bundle it
}

For a Kotlin plugin, follow ALBCore's Build a plugin setup. For a Java plugin, add compileOnly("org.jetbrains.kotlin:kotlin-stdlib:2.4.21") instead of kotlin("stdlib"), so calls that take Kotlin functions compile. Never put any of these into your jar.

Check that it is runningLink to this section

With softdepend, ALBSkyblock may not be installed. Then its classes don't exist, and touching them throws an error. Keep every call to the API in one class, and only create that class when ALBSkyblock is running:

Kotlin
class MyQuests : JavaPlugin() {
    var islands: IslandHook? = null
        private set

    override fun onEnable() {
        if (server.pluginManager.isPluginEnabled("ALBSkyblock")) islands = IslandHook()
    }
}

// The only class that uses ALBSkyblock.
class IslandHook {
    fun mayBuild(player: Player, location: Location): Boolean =
        !SkyblockAPI.isReady || SkyblockAPI.canBuild(player, location)
}
Java
// Java: the same check.
public final class IslandHook {
    public boolean mayBuild(Player player, Location location) {
        return !SkyblockAPI.isReady() || SkyblockAPI.canBuild(player, location);
    }
}
MethodWhat it does
isReadyTrue while ALBSkyblock is enabled. Java: isReady().
plugin()The running ALBSkyblock plugin, the same plugin addons get. Throws when ALBSkyblock is not running.

Inside an addon, the API is not ready during onEnable: it opens after all addons have started. Use plugin there, and the API anywhere later.

ProtectionLink to this section

ALBSkyblock already protects islands from players. Use these checks when your plugin changes blocks or entities on a player's behalf: a building wand, a minion, a gadget, a pet. Then players can't use your feature to get around island protection.

MethodAsks
canBuild(player, location)May the player place blocks here? (right PLACE)
canBreak(player, location)May the player break blocks here? (right BREAK)
canInteract(player, location, permission)May the player do this here? For example IslandPermission.CHEST, DOORS or HURT_ANIMALS.
can(player, island, permission)May the player use this right on this island, wherever they stand? For rights that are not about a spot, like UPGRADES, BANK_WITHDRAW, GENERATOR or INVITE.
hasBypass(player)Is the player staff with bypass on?

The rules are the same as the island protection's own:

  1. Outside the island world, ALBSkyblock protects nothing: the checks say yes.
  2. Staff with albskyblock.bypass.protection (and bypass on, see /is admin bypass) may do everything.
  3. In the void between islands, outside an island's border, or on an island that is being deleted, nobody may.
  4. The owner may do everything on their island. Everyone else needs their role's right, as set in /is permissions. Players without a role use the visitor role.

can is always true for the owner and for staff with bypass on.

Kotlin
// A building wand fills an area itself, so it asks ALBSkyblock for every block.
for (block in area) {
    if (!SkyblockAPI.canBuild(player, block.location)) continue
    block.type = Material.STONE
}

// Only roles with the Upgrades right may buy island upgrades in your shop.
val island = SkyblockAPI.islandOf(player) ?: return
if (!SkyblockAPI.can(player, island, IslandPermission.UPGRADES)) return

Island rightsLink to this section

IslandPermission (in com.aayan.albskyblock.island) lists every right a role can have. Each one has a key, its name in lower case (hurt_animals), as used in config.yml. What each right covers is explained in Island rights.

Building and using: BREAK, PLACE, BUCKETS, BONE_MEAL, TRAMPLE_CROPS, TNT_IGNITE, LIGHT_FIRE, SIGNS, NOTE_BLOCK, CHEST, TRAPPED_CHEST, ENDER_CHEST, BARREL, SHULKER_BOX, HOPPER, DISPENSER, DROPPER, CRAFTER, FURNACE, BLAST_FURNACE, SMOKER, BREWING_STAND, CHISELED_BOOKSHELF, DECORATED_POT, JUKEBOX, LECTERN_READ, LECTERN_TAKE, CRAFTING_TABLE, ENCHANTING_TABLE, ANVIL, GRINDSTONE, SMITHING_TABLE, STONECUTTER, LOOM, CARTOGRAPHY_TABLE, BEACON, DOORS, TRAPDOORS, FENCE_GATES, BUTTONS, LEVERS, PRESSURE_PLATES, REPEATERS, COMPARATORS, DAYLIGHT_DETECTOR, BEDS, RESPAWN_ANCHOR, CAKE, COMPOSTER, CAULDRON, FLOWER_POT, BELL, CAMPFIRE, BEEHIVE, HURT_ANIMALS, HURT_MONSTERS, HURT_VILLAGERS, HURT_PETS, HURT_NAMED, TRADE, SHEAR, MILK, FEED_BREED, LEASH, NAME_TAG, RIDE_ANIMALS, ITEM_FRAMES, ARMOR_STANDS, MINECART_RIDE, MINECART_PLACE, BOAT_RIDE, BOAT_PLACE, DROP_ITEMS, PICKUP_ITEMS, THROW_POTIONS, FISHING_ROD, CARVE_PUMPKINS.

Team rights (never given to visitors): INVITE, KICK, PROMOTE, TRUST, BAN, EXPEL, LOCK, SETTINGS, PERMISSIONS, HOMES, BIOME, GENERATOR, UPGRADES, HELPER, SET_SPAWN, ACTIVITY, BANK_DEPOSIT, BANK_WITHDRAW, BANK_LOG, BANK_SETTINGS, STORAGE, STORAGE_TAKE, MILESTONES, MISSIONS, MINIONS.

Finding islandsLink to this section

MethodReturns
isIslandWorld(world)True for the island world.
islandAt(location)The island whose area holds this spot: inside its border, or in the strip a bigger size left behind. Null in the void and in other worlds.
isInsideBorder(location)True when the spot is on an island and inside its current border.
islandOf(player), islandOf(uuid)The island the player owns or is a team member of. Trusted players don't count. Works for offline players too.
island(id)The island with this id.
islands()Every island.
  • These methods only return active islands. An island that is being deleted counts as gone.
  • All islands are kept in memory a moment after the server starts, so the lookups don't touch the database.
  • An Island is a snapshot. When its size or owner changes, ALBSkyblock makes a new Island object. Keep the id, and look the island up again with island(id) when you need it.

People on an islandLink to this section

MethodReturns
role(island, uuid)The player's role. Null for the owner, the visitor role for players without a role.
isOwner(island, uuid)True for the owner.
isMember(island, uuid)True for the owner and every team role (member, officer, co-owner...).
isTrusted(island, uuid)True for everyone but visitors: owner, team and trusted-like roles.
isBanned(island, uuid)True when the player is banned from the island.
members(island)The owner and team members (UUIDs), owner first.
Kotlin
val island = SkyblockAPI.islandAt(player.location) ?: return
if (SkyblockAPI.isMember(island, player.uniqueId)) {
    // the player is home
}

IslandRoleLink to this section

Roles are set up by the server in config.yml and /is admin editor > Roles. See Owner, team and roles.

FieldWhat it is
keyThe role's id: trusted, member, officer, co_owner, or a custom one.
rankHigher ranks outrank lower ones. The visitor role is 0, trusted-like roles are 1 to 49, team roles 50 to 999.
isTeamTrue for team roles.
isVisitorTrue for the visitor role.
builtInTrue for trusted, member, officer and co_owner.
enabledFalse when the server turned the role off.
displayNameThe name of a custom role. Null for built-in roles (their names are in lang.yml).

A role the server turned off keeps its players: they act as the nearest lower role of the same kind. role() already gives you the role they act as.

The Island modelLink to this section

com.aayan.albskyblock.island.Island describes one island. It is read-only.

FieldTypeWhat it is
idLongThe island's id. It never changes, also not on transfer or reset.
ownerUUIDThe owner.
worldNameStringThe island world. Use Bukkit.getWorld(island.worldName).
centerX, centerY, centerZIntThe centre block.
sizeIntThe current border size, in blocks per side.
maxSizeIntThe largest size the island ever had.
reachIntThe bigger of size and maxSize: the area the island may ever touch.
spawnSpawnOffsetThe island spawn, relative to the centre: x, y, z, yaw, pitch.
templateStringThe name of the schema the island was made from.
stateIslandStateACTIVE, or DELETING while it is being deleted.
createdAtLongWhen it was made (milliseconds since 1970).
gridIndexIntIts slot in the island grid.
MethodWhat it does
insideBorder(x, z)True when block x, z is inside the current border.
insideReach(x, z)True when it is inside the largest area the island ever had.
contains(location, margin)True when the location is in the island's world and inside the border, grown by margin blocks.
center(world)The centre block as a Location.
spawnLocation(world)The island spawn as a Location.
minX(margin), maxX(margin), minZ(margin), maxZ(margin)The border's block bounds (inclusive), grown by margin.

From Java, the fields are getters (island.getId(), island.getOwner()), and margin must be given: island.contains(location, 0).

Island bankLink to this section

The island bank is a shared money balance per island. It comes from an addon, normally Island Bank. SkyblockAPI.bank() returns it, or null when no bank addon is installed.

IslandBankWhat it does
balance(island)The island's balance now.
capacity(island)The most the island may hold.
take(island, amount, player, reason)Takes money out. Completes with false, and takes nothing, when the bank has too little or is busy.
give(island, amount, player, reason)Puts money in. It ignores the capacity. Completes with false when it could not be saved.
isBusy(island)True while the bank is in the middle of another change or still loading. take and give refuse then: try again a few ticks later.
  • player is who did it (null for none). reason shows in the island's bank history, like "Quest: Lost Relic".
  • Every change is saved and written to the history, and fires IslandBankTransactionEvent.
  • The futures complete on the main thread.
Kotlin
val bank = SkyblockAPI.bank() ?: return
val island = SkyblockAPI.islandOf(player) ?: return
bank.give(island, 500.0, player, "Quest: Lost Relic").thenAccept { ok ->
    if (!ok) player.sendMessage("The island bank is busy. Try again in a moment.")
}

To charge a player for something, don't call take yourself: use payments. It refunds by itself when something goes wrong.

Island levelsLink to this section

Island levels come from an addon, normally Level. SkyblockAPI.levels() returns them, or null when no level addon is installed.

An island's total XP is its Block XP (from the valued blocks on it right now; mining them takes it back) plus its bonus XP (from missions, milestones and other plugins; it never goes down). The level comes from the total XP. See Island XP.

IslandLevelsWhat it does
loadedTrue once levels are loaded. Before that, level reads 0 and addBonusXp gives nothing.
level(island)The island's level now.
totalXp(island)Block XP plus bonus XP.
blockXp(island)XP from the blocks on the island now.
bonusXp(island)XP given by missions, milestones and other plugins.
addBonusXp(island, amount, reason)Gives bonus XP. Amounts of 0 or less are ignored. Level-ups happen as usual. reason only goes to the server log.
Kotlin
val levels = SkyblockAPI.levels() ?: return
if (!levels.loaded) return          // given now, the XP would be lost: try again later
levels.addBonusXp(island, 250, "Quest: Lost Relic")

Each level change fires IslandLevelChangeEvent.

PaymentsLink to this section

SkyblockAPI.payments() is ALBSkyblock's safe purchase system, the same one the official addons use. It takes the money (from the player or the island bank) and items first, then runs your code to apply the purchase, and gives everything back if that fails. Only one purchase runs per island at a time.

Kotlin
SkyblockAPI.payments().charge(player, island, 2500.0, Payer.PLAYER, "Quest shop: Island Banner") {
    giveBanner(island)   // must complete with true only once it is saved
}.thenAccept { result ->
    if (result != PaymentResult.DONE) SkyblockAPI.payments().explain(player, result, 2500.0)
}

Payer and PaymentResult are in the package com.aayan.albskyblock. From Java, pass the items map too (Map.of() for none). How charge works and every result are explained in Sell things safely.

Hidden islandsLink to this section

Staff can hide islands from every leaderboard, for example their own test islands, with /is admin top hide <player> (Leaderboards addon). If your plugin ranks islands itself, leave hidden islands out too:

Kotlin
val plugin = SkyblockAPI.plugin()
val ranked = SkyblockAPI.islands().filter { !LeaderboardHidden.isHidden(plugin, it) }
LeaderboardHiddenWhat it does
isHidden(plugin, island)True when the island is hidden from leaderboards.
set(plugin, island, hidden)Hides or shows the island. /is top picks it up at its next rebuild.
FLAGThe island flag that stores it: leaderboard.hidden.

LeaderboardHidden is in com.aayan.albskyblock.api.

Type a class, method, config key or topic. Use the arrow keys and Enter to open a result.