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 work
- Listen to an event
- All events
- Islands
- IslandCreatedEvent
- IslandDeletedEvent
- IslandResetStartEvent
- IslandResetEvent
- IslandEnterEvent
- IslandLeaveEvent
- IslandSizeChangeEvent
- IslandTransferEvent
- IslandTransferredEvent
- Team
- IslandMemberJoinEvent
- IslandMemberLeaveEvent
- IslandRoleChangeEvent
- IslandBanEvent
- IslandUnbanEvent
- IslandExpelEvent
- Purchases
- IslandPrePurchaseEvent
- IslandPurchaseEvent
- IslandUpgradeEvent
- Bank
- IslandBankTransactionEvent
- Generators
- IslandGeneratorSwitchEvent
- IslandGeneratorUnlockEvent
- IslandGeneratorProduceEvent
- Level
- IslandLevelChangeEvent
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
actoris who did it; null means the console or the server. UseBukkit.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.
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!")
}
}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
| Event | When | Can cancel | Fired by |
|---|---|---|---|
IslandCreatedEvent | An island was created. | no | ALBSkyblock |
IslandDeletedEvent | An island is being deleted. | no | ALBSkyblock |
IslandResetStartEvent | An island is about to be reset. | no | ALBSkyblock |
IslandResetEvent | An island was reset. | no | ALBSkyblock |
IslandEnterEvent | A player stepped inside an island's border. | no | ALBSkyblock |
IslandLeaveEvent | A player stepped out of an island's border. | no | ALBSkyblock |
IslandSizeChangeEvent | An island's size changed. | no | ALBSkyblock |
IslandTransferEvent | An island is about to get a new owner. | yes | ALBSkyblock |
IslandTransferredEvent | An island got a new owner. | no | ALBSkyblock |
IslandMemberJoinEvent | A player joins a team or is trusted. | yes | ALBSkyblock |
IslandMemberLeaveEvent | A player leaves a team or loses trust. | yes | ALBSkyblock |
IslandRoleChangeEvent | A player's role changes. | yes | ALBSkyblock |
IslandBanEvent | A player is banned from an island. | yes | ALBSkyblock |
IslandUnbanEvent | A player is unbanned. | yes | ALBSkyblock |
IslandExpelEvent | A visitor is sent off an island. | yes | ALBSkyblock |
IslandPrePurchaseEvent | A player is about to pay for something. | yes | ALBSkyblock (payments) |
IslandPurchaseEvent | A purchase was paid and saved. | no | ALBSkyblock (payments) |
IslandUpgradeEvent | An island upgrade tier changed. | no | Upgrades addon |
IslandBankTransactionEvent | The island bank balance changed. | no | Island Bank addon |
IslandGeneratorSwitchEvent | A player switches the generator tier. | yes | Generators addon |
IslandGeneratorUnlockEvent | The best unlocked generator tier changed. | no | Generators addon |
IslandGeneratorProduceEvent | A generator is about to make a block. | yes | Generators addon |
IslandLevelChangeEvent | An island's level went up or down. | no | Level 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.
| Field | Type | What it is |
|---|---|---|
island | Island | The new island. |
player | Player | The 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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island, as it was. |
Use it to drop everything your plugin keeps for that island:
@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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
actor | Player? | 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...).
| Field | Type | What it is |
|---|---|---|
island | Island | The island after the reset (its spawn and reach are back to the schema's). |
actor | Player? | Who reset it: the owner, an admin, or null from the console. |
wipedReach | Int | The 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.
| Field | Type | What it is |
|---|---|---|
player | Player | Who arrived. |
island | Island | The island. |
title | String (changeable) | The title. Colour codes work. |
subtitle | String (changeable) | The subtitle. By default the border.enter-own or border.enter-other message. |
When both title and subtitle are empty, no title shows.
@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.
| Field | Type | What it is |
|---|---|---|
player | Player | Who left. |
island | Island | The island. |
IslandSizeChangeEventLink to this section
An island's size changed: through the owner's albskyblock.size.<N> permission, an upgrade, or /is admin setsize.
| Field | Type | What it is |
|---|---|---|
island | Island | The island, with its new size. |
oldSize | Int | The size before. |
grew | Boolean | True 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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
oldOwner | UUID | The owner now. |
newOwner | UUID | The owner after the transfer. |
actor | UUID? | 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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island, with its new owner. |
oldOwner | UUID | The owner before. |
newOwner | UUID | The new owner. |
actor | UUID? | 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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
player | UUID | Who joins. |
role | IslandRole | The role they get: a team role (member, officer...) or a trusted-like role. |
trusted | Boolean | True for a trusted-like role (not part of the team). |
actor | UUID? | Who invited them, or the admin. Null from the console. |
// 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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
player | UUID | Who leaves. |
role | IslandRole | The role they had. |
reason | Reason | Why (below). |
actor | UUID? | Who did it: the player (LEFT), the kicker, the banner, or null for the console. |
Reason | When |
|---|---|
LEFT | /is leave. |
KICKED | Removed by a team mate: /is kick, /is untrust or the team menu. |
ADMIN | Removed by staff: /is admin kick. |
BANNED | A 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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
player | UUID | Whose role changes. |
oldRole | IslandRole | The role now. |
newRole | IslandRole | The role after the change. |
actor | UUID? | 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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
player | UUID | Who is banned. |
actor | UUID? | 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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
player | UUID | Who is unbanned. |
actor | UUID? | Who unbans them. |
IslandExpelEventLink to this section
A visitor is sent off an island with /is expel. Cancel it to let them stay.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
player | Player | The visitor. |
actor | UUID? | 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.").
| Field | Type | What it is |
|---|---|---|
player | Player | Who buys. |
island | Island | For which island. |
cost | Double | The money (0 when it costs none). |
payer | Payer | PLAYER (their own money) or BANK (the island bank). |
reason | String | Plain text, like "Upgrade: Island Size II". |
items | Map<ItemRef, Int> | Items taken from the player's inventory (empty when none). |
@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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
player | Player? | Who bought it. Null when an admin set it. |
upgrade | String | The upgrade's id in the Upgrades config. |
key | String | What it raises: size, team, generator, limit.hopper... See Island bonuses. |
tier | Int | The 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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
player | UUID? | Who did it. Null for interest, staff from the console, and so on. |
kind | Kind | What kind of change (below). |
amount | Double | The change: positive is money in, negative is money out. |
balance | Double | The new balance. |
note | String | The note in the bank history, like "Upgrade: Island Size II". |
Kind | What happened |
|---|---|
DEPOSIT | A member put money in. |
WITHDRAW | A member took money out. |
INTEREST | Interest was paid. |
PAYMENT | The island paid an addon (an upgrade...). |
INCOME | An addon paid the island (a refund, a reward...). |
ADMIN | Staff changed it (/is admin bank), or a failed payout was put back. |
@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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
player | Player | Who switches. |
oldTier | Int | The tier in use now. |
newTier | Int | The 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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
oldTier | Int | The best tier before. |
newTier | Int | The best tier now. |
source | Source | ADMIN, 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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
block | Block | Where the block forms. |
tier | Int | The generator tier. |
kind | Kind | COBBLESTONE or BASALT. |
material | Material (changeable) | The block it makes. Set it to any solid block. |
nexoId | String? (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. |
instant | Boolean | True when the generator speed upgrade made it at once, without water and lava. |
// 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.
| Field | Type | What it is |
|---|---|---|
island | Island | The island. |
oldLevel | Int | The level before. |
newLevel | Int | The level now. |
up | Boolean | True when the level went up. |
@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}!"))
}
}