ALB Studio

Events

Every island event ALBSkyblock and its addons fire, when each one fires, whether you can cancel it, and what it carries.

Docs updated ยท What changed

On this page

How island events workLink to this section

ALBSkyblock and its addons fire normal Bukkit events when something happens on an island: it is created, someone joins the team, a generator makes a block, the bank changes. Your plugin or addon listens to them like to any other Bukkit event.

All events are in the package com.aayan.albskyblock.api.event.

  • Every event is called on the main thread.
  • Cancellable events are called before the change. Cancel one to stop the change. The player who tried it is told it was blocked.
  • Events that can't be cancelled are called after the change.
  • Actors are UUIDs. An actor is who did it; null means the console or the server. Use Bukkit.getPlayer(uuid) to get the online player.

Listen to an eventLink to this section

From an addon, register the listener with context.registerListener(this). See Addon API. From a plugin, register it as usual and add ALBSkyblock to your plugin.yml. See Skyblock API.

Kotlin
class IslandListener : Listener {

    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    fun onJoin(event: IslandMemberJoinEvent) {
        if (event.trusted) return
        val owner = Bukkit.getOfflinePlayer(event.island.owner).name
        Bukkit.getPlayer(event.player)?.sendMessage("Welcome to $owner's island!")
    }
}
Java
public final class IslandListener implements Listener {

    @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    public void onJoin(IslandMemberJoinEvent event) {
        if (event.getTrusted()) return;
        String owner = Bukkit.getOfflinePlayer(event.getIsland().getOwner()).getName();
        Player player = Bukkit.getPlayer(event.getPlayer());
        if (player != null) player.sendMessage("Welcome to " + owner + "'s island!");
    }
}

All eventsLink to this section

EventWhenCan cancelFired by
IslandCreatedEventAn island was created.noALBSkyblock
IslandDeletedEventAn island is being deleted.noALBSkyblock
IslandResetStartEventAn island is about to be reset.noALBSkyblock
IslandResetEventAn island was reset.noALBSkyblock
IslandEnterEventA player stepped inside an island's border.noALBSkyblock
IslandLeaveEventA player stepped out of an island's border.noALBSkyblock
IslandSizeChangeEventAn island's size changed.noALBSkyblock
IslandTransferEventAn island is about to get a new owner.yesALBSkyblock
IslandTransferredEventAn island got a new owner.noALBSkyblock
IslandMemberJoinEventA player joins a team or is trusted.yesALBSkyblock
IslandMemberLeaveEventA player leaves a team or loses trust.yesALBSkyblock
IslandRoleChangeEventA player's role changes.yesALBSkyblock
IslandBanEventA player is banned from an island.yesALBSkyblock
IslandUnbanEventA player is unbanned.yesALBSkyblock
IslandExpelEventA visitor is sent off an island.yesALBSkyblock
IslandPrePurchaseEventA player is about to pay for something.yesALBSkyblock (payments)
IslandPurchaseEventA purchase was paid and saved.noALBSkyblock (payments)
IslandUpgradeEventAn island upgrade tier changed.noUpgrades addon
IslandBankTransactionEventThe island bank balance changed.noIsland Bank addon
IslandGeneratorSwitchEventA player switches the generator tier.yesGenerators addon
IslandGeneratorUnlockEventThe best unlocked generator tier changed.noGenerators addon
IslandGeneratorProduceEventA generator is about to make a block.yesGenerators addon
IslandLevelChangeEventAn island's level went up or down.noLevel addon

Events fired by an addon only happen when that addon is installed. Listening to them without the addon is harmless.

IslandsLink to this section

The island in an event is an Island object. See The Island model.

IslandCreatedEventLink to this section

An island was created. Its blocks are already placed. It fires before the intro starts.

FieldTypeWhat it is
islandIslandThe new island.
playerPlayerThe new owner.

IslandDeletedEventLink to this section

An island is being deleted. Its blocks are wiped right after this event. A delete that a restart interrupted is finished on the next start, and fires this event again then.

FieldTypeWhat it is
islandIslandThe island, as it was.

Use it to drop everything your plugin keeps for that island:

Kotlin
@EventHandler
fun onDeleted(event: IslandDeletedEvent) {
    val db = ALBCore.instance.database
    db.update("DELETE FROM ${db.table("skyblock_motto_history")} WHERE island_id = ?", event.island.id)
}

IslandResetStartEventLink to this section

An island is about to be reset. Players on it were already moved away. Its blocks are wiped and its schema pasted right after.

If your plugin puts blocks into islands by itself (generators of its own, minions, farms), stop for this island here, so nothing lands in the fresh island.

FieldTypeWhat it is
islandIslandThe island.
actorPlayer?Who resets it. Null from the console.

IslandResetEventLink to this section

An island was reset: its blocks were wiped and its schema pasted again. The team, trusted players, bans and settings stay. Drop data that belonged to the old blocks here (homes, block counts...).

FieldTypeWhat it is
islandIslandThe island after the reset (its spawn and reach are back to the schema's).
actorPlayer?Who reset it: the owner, an admin, or null from the console.
wipedReachIntThe size of the area the wipe covered, from before the reset shrank the island's reach back to its size.

IslandEnterEventLink to this section

A player stepped inside an island's border. ALBSkyblock checks this twice a second. The event comes with the arrival title that is about to show, and you may change it.

FieldTypeWhat it is
playerPlayerWho arrived.
islandIslandThe island.
titleString (changeable)The title. Colour codes work.
subtitleString (changeable)The subtitle. By default the border.enter-own or border.enter-other message.

When both title and subtitle are empty, no title shows.

Kotlin
@EventHandler
fun onEnter(event: IslandEnterEvent) {
    if (isEventIsland(event.island)) event.title = "&6&lEvent island"
}

IslandLeaveEventLink to this section

A player stepped out of an island's border, into the void between islands or another world. Leaving the team is IslandMemberLeaveEvent.

FieldTypeWhat it is
playerPlayerWho left.
islandIslandThe island.

IslandSizeChangeEventLink to this section

An island's size changed: through the owner's albskyblock.size.<N> permission, an upgrade, or /is admin setsize.

FieldTypeWhat it is
islandIslandThe island, with its new size.
oldSizeIntThe size before.
grewBooleanTrue when the island got bigger.

IslandTransferEventLink to this section

An island is about to get a new owner, through /is transfer or /is admin setowner. Cancel it to stop the transfer. The new owner is not saved yet and saving can still fail: react to the finished change with IslandTransferredEvent.

FieldTypeWhat it is
islandIslandThe island.
oldOwnerUUIDThe owner now.
newOwnerUUIDThe owner after the transfer.
actorUUID?Who did it: the old owner, an admin, or null.

IslandTransferredEventLink to this section

An island now belongs to its new owner, and that is saved.

FieldTypeWhat it is
islandIslandThe island, with its new owner.
oldOwnerUUIDThe owner before.
newOwnerUUIDThe new owner.
actorUUID?Who did it: the old owner, an admin, or null.

TeamLink to this section

The role fields are IslandRole objects. See People on an island. When a listener cancels a team event, the player who tried gets the team.blocked message ("That was blocked.").

IslandMemberJoinEventLink to this section

A player joins an island's team, or is trusted on it. It fires for /is accept (after an invite or a trust) and for /is admin addmember. A trusted player who is moved into the team also counts as joining. Cancel it to stop the join.

FieldTypeWhat it is
islandIslandThe island.
playerUUIDWho joins.
roleIslandRoleThe role they get: a team role (member, officer...) or a trusted-like role.
trustedBooleanTrue for a trusted-like role (not part of the team).
actorUUID?Who invited them, or the admin. Null from the console.
Kotlin
// No team changes while a tournament runs.
@EventHandler(ignoreCancelled = true)
fun onJoin(event: IslandMemberJoinEvent) {
    if (tournamentRunning && !event.trusted) event.isCancelled = true
}

IslandMemberLeaveEventLink to this section

A player stops being part of an island (team or trusted). Cancel it to stop it. It does not fire when the whole island is deleted, nor for the old owner in a transfer.

FieldTypeWhat it is
islandIslandThe island.
playerUUIDWho leaves.
roleIslandRoleThe role they had.
reasonReasonWhy (below).
actorUUID?Who did it: the player (LEFT), the kicker, the banner, or null for the console.
ReasonWhen
LEFT/is leave.
KICKEDRemoved by a team mate: /is kick, /is untrust or the team menu.
ADMINRemoved by staff: /is admin kick.
BANNEDA trusted player is being banned. It fires after IslandBanEvent passed. Cancelling it stops the whole ban.

IslandRoleChangeEventLink to this section

A player's role on an island changes: promote, demote, or an admin setting the role. Cancel it to stop the change.

FieldTypeWhat it is
islandIslandThe island.
playerUUIDWhose role changes.
oldRoleIslandRoleThe role now.
newRoleIslandRoleThe role after the change.
actorUUID?Who did it. Null from the console.

IslandBanEventLink to this section

A player is banned from an island. Cancel it to stop the ban. If the player was trusted, IslandMemberLeaveEvent with reason BANNED follows.

FieldTypeWhat it is
islandIslandThe island.
playerUUIDWho is banned.
actorUUID?Who bans them.

IslandUnbanEventLink to this section

A player is unbanned through /is unban or the bans menu. Cancel it to keep the ban. A banned player who joins the island (an accepted invite, /is admin addmember) is unbanned without this event.

FieldTypeWhat it is
islandIslandThe island.
playerUUIDWho is unbanned.
actorUUID?Who unbans them.

IslandExpelEventLink to this section

A visitor is sent off an island with /is expel. Cancel it to let them stay.

FieldTypeWhat it is
islandIslandThe island.
playerPlayerThe visitor.
actorUUID?Who expels them.

PurchasesLink to this section

Every purchase made through ALBSkyblock's safe payments (upgrades, generator tiers, anything an addon sells with plugin.payments.charge) fires these two events. See Sell things safely.

IslandPrePurchaseEventLink to this section

A player is about to pay. Nothing has been taken yet. Cancel it to stop the purchase. The purchase then ends with PaymentResult.CANCELLED, and the official addons show the buyer the payments.cancelled message ("That purchase was blocked.").

FieldTypeWhat it is
playerPlayerWho buys.
islandIslandFor which island.
costDoubleThe money (0 when it costs none).
payerPayerPLAYER (their own money) or BANK (the island bank).
reasonStringPlain text, like "Upgrade: Island Size II".
itemsMap<ItemRef, Int>Items taken from the player's inventory (empty when none).
Kotlin
@EventHandler(ignoreCancelled = true)
fun onPrePurchase(event: IslandPrePurchaseEvent) {
    if (maintenance) event.isCancelled = true
}

IslandPurchaseEventLink to this section

A player paid and the purchase was saved. Same fields as IslandPrePurchaseEvent: player, island, cost, payer, reason, items.

IslandUpgradeEventLink to this section

An island upgrade tier changed in the Upgrades addon: bought, or set by an admin. Plugins that keep island values in memory refresh them here. The new tier counts from this moment. If saving it fails after a purchase, the addon puts the old tier back and this event fires again with the old tier.

FieldTypeWhat it is
islandIslandThe island.
playerPlayer?Who bought it. Null when an admin set it.
upgradeStringThe upgrade's id in the Upgrades config.
keyStringWhat it raises: size, team, generator, limit.hopper... See Island bonuses.
tierIntThe new tier. 0 means none.

BankLink to this section

IslandBankTransactionEventLink to this section

An island's bank balance changed and the change is saved. It fires for every change, from players, interest, addons and staff.

FieldTypeWhat it is
islandIslandThe island.
playerUUID?Who did it. Null for interest, staff from the console, and so on.
kindKindWhat kind of change (below).
amountDoubleThe change: positive is money in, negative is money out.
balanceDoubleThe new balance.
noteStringThe note in the bank history, like "Upgrade: Island Size II".
KindWhat happened
DEPOSITA member put money in.
WITHDRAWA member took money out.
INTERESTInterest was paid.
PAYMENTThe island paid an addon (an upgrade...).
INCOMEAn addon paid the island (a refund, a reward...).
ADMINStaff changed it (/is admin bank), or a failed payout was put back.
Kotlin
@EventHandler
fun onBank(event: IslandBankTransactionEvent) {
    if (event.kind == IslandBankTransactionEvent.Kind.WITHDRAW && -event.amount >= 1_000_000) {
        logger.info("Island ${event.island.id} withdrew ${-event.amount}")
    }
}

GeneratorsLink to this section

Generator tiers start at 1.

IslandGeneratorSwitchEventLink to this section

A player switches their island's generator tier in /is gen. Cancel it to stop the switch.

FieldTypeWhat it is
islandIslandThe island.
playerPlayerWho switches.
oldTierIntThe tier in use now.
newTierIntThe tier they picked.

IslandGeneratorUnlockEventLink to this section

The best generator tier an island may use changed: through an upgrade, the owner's rank permission, or /is admin gen settier. The change is noticed the next time the addon looks at the island's tier, so this event can come a little later than the change itself.

FieldTypeWhat it is
islandIslandThe island.
oldTierIntThe best tier before.
newTierIntThe best tier now.
sourceSourceADMIN, UPGRADE or PERMISSION.

IslandGeneratorProduceEventLink to this section

A generator on an island is about to make a block. The block was already rolled from the tier's table. Cancel it to stop the block from forming at all. You may also change the block.

FieldTypeWhat it is
islandIslandThe island.
blockBlockWhere the block forms.
tierIntThe generator tier.
kindKindCOBBLESTONE or BASALT.
materialMaterial (changeable)The block it makes. Set it to any solid block.
nexoIdString? (changeable)Set when it is a Nexo custom block (material is then the block it is made of, like NOTE_BLOCK). Set it to another Nexo block id to make that instead.
instantBooleanTrue when the generator speed upgrade made it at once, without water and lava.
Kotlin
// Count cobblestone for a collection.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
fun onProduce(event: IslandGeneratorProduceEvent) {
    if (event.material == Material.COBBLESTONE && event.nexoId == null) addProduced(event.island, 1)
}

LevelLink to this section

IslandLevelChangeEventLink to this section

An island's level changed in the Level addon: blocks were placed or broken, bonus XP came in, or the island was scanned again. Mining valued blocks lowers the level, so it can go down too.

FieldTypeWhat it is
islandIslandThe island.
oldLevelIntThe level before.
newLevelIntThe level now.
upBooleanTrue when the level went up.
Kotlin
@EventHandler
fun onLevel(event: IslandLevelChangeEvent) {
    if (event.up && event.newLevel % 10 == 0) {
        val owner = Bukkit.getOfflinePlayer(event.island.owner).name
        Bukkit.broadcast(Component.text("$owner's island reached level ${event.newLevel}!"))
    }
}

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