Events
Everything a plugin can react to. Some events come before something happens and can stop it; the rest say it has happened.
A plugin listens by giving a handler for an event, usually in enable. In Rust that is server.events().on_player_joined(|event| ...), in Java server.events().onPlayerJoined(event -> ...). Events arrive on the server's tick, and plugins hear each one in the order they loaded.
An event that can be stopped is sent before the thing happens, and its name says so (BlockBreaking). Calling stop() on it means the thing does not happen, and the player's game puts back whatever it had already shown. A listener can also change the fields marked changeable, such as the damage taken or the loot dropped. The event that follows (BlockBroken) says it did happen and cannot be stopped.
Listening
A handler can read every field of its event. Fields it may change are marked changeable below, and each handler sees the changes the one before it made. This one stops blocks being broken below Y 0:
server.events().on_block_breaking(|event| {
if event.block.at.y < 0 {
event.stop();
}
})?;server.events().onBlockBreaking(event -> {
if (event.block().at().y() < 0) {
event.stop();
}
});
Players
| Event | When | Can stop |
|---|---|---|
PlayerJoining | A player has proved who they are and is about to enter the world. | Yes |
PlayerJoined | A player has entered the world and can be seen. | |
PlayerLeft | A player has left: by choice, put out, or their connection ended. | |
PlayerDamaging | A player is about to be hurt. | Yes |
PlayerFainted | A player's health reached nothing and they fainted. | |
PlayerRespawning | A fainted player is getting up again. | Yes |
PlayerMovedBlock | A player's feet moved into another block. Sent once a block, not every tick. | |
PlayerEnteredRegion | A player walked into a Region a plugin made. | |
PlayerLeftRegion | A player walked out of a Region. | |
PlayerEnteredTown | A player came into a town (checked four times a second). | |
PlayerEnteredDungeon | A player went down into a dungeon (when its banner shows). | |
PlayerAte | A player ate or drank something. | Yes |
PlayerRested | A player sitting by a campfire was healed a step. |
Blocks and objects
| Event | When | Can stop |
|---|---|---|
BlockBreaking | A player is about to break a block. | Yes |
BlockBroken | A block was broken by a player. | |
BlockPlacing | A player is about to place a block. | Yes |
BlockPlaced | A player placed a block. | |
BlockChanged | Any block changed that the world keeps, by anyone or anything: a player, water or lava flowing, sand falling, a plant growing, a plugin. Changes the world does not keep (a trap's spikes, falling snow, a boss room's lights) do not send it. | |
ObjectPlacing | A player is about to place an object: furniture, a station, a chest, a bed, a door. | Yes |
ObjectRemoved | A placed object was taken down whole and dropped as an item (a server object made from a content pack's model drops nothing): broken by a player, or fallen with what held it up. An object a plugin removes without a drop does not send it. | |
ContainerOpening | A player is opening a chest, barrel or other container. | Yes |
DoorUsed | A player opened or shut a door or gate. | Yes |
Items and crafting
| Event | When | Can stop |
|---|---|---|
ItemPickingUp | A player is taking up a loose item. | Yes |
ItemDropped | A player let go of or threw an item. | |
ItemCrafting | A finished piece is about to be taken off its station, the moment the craft is the taker's: a workbench's output, an anvil's or fletching bench's piece, a forge's ingot (by hand or tongs), food cooked on a campfire's rim. A brew bottled from a cauldron or a meal ladled from a pot does not send it yet. | Yes |
ItemCrafted | A finished piece was taken off its station (after ItemCrafting). | |
FishCaught | A player landed a catch with a rod. A fish sends this before it lands, so its item can be changed, and a hooked Voxelmon sends it once it has landed. A fish speared with a trident does not send it yet. | |
LootRolled | Loot was chosen: a supply cache or a dungeon's cache broken, a chest filled as its town, dungeon or cave find is furnished, a wild Voxelmon's drops beaten in the world or in a battle (at most two stacks a beaten foe in a battle). Content packs' loot rules are added before plugins see it. A fishing catch sends FishCaught instead. |
Voxelmon
| Event | When | Can stop |
|---|---|---|
CreatureSpawning | A wild Voxelmon is about to appear, from the wild, a dungeon or a hive. It is sent on the tick the creature is made, before any player sees it. A den's pack, a hooked Voxelmon, a guardian and a plugin's own spawns do not send it yet. A content pack's spawn rule changes a wild one's species and level before plugins see it. | Yes |
CreatureSpawned | A wild Voxelmon appeared. | |
CreatureDamaging | A wild Voxelmon is about to be hurt in the world: by a player's blow, arrow or trident, a burn, a falling spike. Harm in a turn-based battle and a companion's blows in an action world do not send it yet. | Yes |
CreatureBeaten | A wild Voxelmon was beaten: in a turn-based battle, or in the world by a player's blow. One knocked out by a companion in an action world does not send it yet. | |
CaptureAttempt | A cube thrown in the world is about to try to catch a Voxelmon. A cube used in a turn-based battle does not send it yet. | Yes |
CreatureCaptured | A Voxelmon was caught. | |
CreatureLevelledUp | A player's Voxelmon reached a new level. | |
CreatureEvolving | A player's Voxelmon is about to evolve. | Yes |
CreatureEvolved | A player's Voxelmon evolved. | |
CompanionSentOut | A player threw a cube and their Voxelmon came out. | |
CompanionRecalled | A player's companion went back into its cube. | |
CreaturePetted | A player petted their companion. |
Battles
| Event | When | Can stop |
|---|---|---|
BattleStarting | A turn-based battle is about to begin, against a wild Voxelmon or a trainer. | Yes |
BattleStarted | A battle began. | |
BattleTurn | A battle's turn was decided. | |
BattleEnded | A battle ended. It is sent when the result is decided (before the last turn's BattleTurn) or when the battle is called off. |
Progress
| Event | When | Can stop |
|---|---|---|
ProfessionLevelledUp | A player reached a new level in a profession. | |
CoinsChanged | A player's coins changed. | |
TownFreed | A town's Voxelord was beaten and the town freed. | |
DungeonBeaten | A dungeon's guardian was beaten. players are those standing over the dungeon at that moment. | |
DungeonReset | A beaten dungeon reset: at the first dawn a full day after its guardian fell, with no player inside, its chests refilled and its guardian will return; or through Dungeon.reset. |
World
| Event | When | Can stop |
|---|---|---|
DayStarted | Dawn: a new day began. | |
NightStarted | Dusk: night began. | |
WeatherChanged | The weather changed in kind or strength (World.weather), because a spell of weather began or ended or a plugin set it. | |
WorldSaved | The world was saved. |
Menus
| Event | When | Can stop |
|---|---|---|
MenuPressed | A player pressed a button, tile or toggle on a plugin's Menu. | |
MenuClosed | A player closed a plugin's menu, or walked away from it. |
Each event
PlayerJoining
server.events().on_player_joining(|event: &mut PlayerJoining| ...)server.events().onPlayerJoining((PlayerJoining event) -> ...)
A player has proved who they are and is about to enter the world.
Can be stopped: the player is turned away with `reason`.
| Field | Description |
|---|---|
event.profile: PlayerProfilePlayerProfile event.profile() | Their store account's name and lasting ID, and whether they have played here before. |
event.reason: StringString event.reason() / event.setReason(...) changeable | What they are told if stopped. |
PlayerJoined
server.events().on_player_joined(|event: & PlayerJoined| ...)server.events().onPlayerJoined((PlayerJoined event) -> ...)
A player has entered the world and can be seen.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | The player. |
event.first_time: boolboolean event.firstTime() | Their first time in this world. |
PlayerLeft
server.events().on_player_left(|event: & PlayerLeft| ...)server.events().onPlayerLeft((PlayerLeft event) -> ...)
A player has left: by choice, put out, or their connection ended.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | The player, still readable during this event. |
event.reason: LeaveReasonLeaveReason event.reason() | Why they left. |
PlayerDamaging
server.events().on_player_damaging(|event: &mut PlayerDamaging| ...)server.events().onPlayerDamaging((PlayerDamaging event) -> ...)
A player is about to be hurt.
Can be stopped: they take no harm.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who is hurt. |
event.amount: f64double event.amount() / event.setAmount(...) changeable | Health lost. |
event.cause: DamageCauseDamageCause event.cause() | A creature, a fall, drowning, hunger, burning, a trap, a falling spike. |
event.creature: Option<Creature>Optional<Creature> event.creature() | The creature, if one did it (not yet: always empty; cause says a creature). |
PlayerFainted
server.events().on_player_fainted(|event: &mut PlayerFainted| ...)server.events().onPlayerFainted((PlayerFainted event) -> ...)
A player's health reached nothing and they fainted.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who fainted. |
event.cause: DamageCauseDamageCause event.cause() | What did it. |
event.keep_inventory: boolboolean event.keepInventory() / event.setKeepInventory(...) changeable | Whether they keep what they carry. |
PlayerRespawning
server.events().on_player_respawning(|event: &mut PlayerRespawning| ...)server.events().onPlayerRespawning((PlayerRespawning event) -> ...)
A fainted player is getting up again.
Can be stopped: they stay down (as in Hardcore).
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who is getting up. |
event.place: PlacePlace event.place() / event.setPlace(...) changeable | Where they will stand. |
PlayerMovedBlock
server.events().on_player_moved_block(|event: & PlayerMovedBlock| ...)server.events().onPlayerMovedBlock((PlayerMovedBlock event) -> ...)
A player's feet moved into another block. Sent once a block, not every tick.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who moved. |
event.from: BlockPosBlockPos event.from() | The block they left. |
event.to: BlockPosBlockPos event.to() | The block they are in now. |
PlayerEnteredRegion
server.events().on_player_entered_region(|event: & PlayerEnteredRegion| ...)server.events().onPlayerEnteredRegion((PlayerEnteredRegion event) -> ...)
A player walked into a Region a plugin made.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who entered. |
event.region: RegionRegion event.region() | The region. |
PlayerLeftRegion
server.events().on_player_left_region(|event: & PlayerLeftRegion| ...)server.events().onPlayerLeftRegion((PlayerLeftRegion event) -> ...)
A player walked out of a Region.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who left. |
event.region: RegionRegion event.region() | The region. |
PlayerEnteredTown
server.events().on_player_entered_town(|event: & PlayerEnteredTown| ...)server.events().onPlayerEnteredTown((PlayerEnteredTown event) -> ...)
A player came into a town (checked four times a second).
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who entered. |
event.town: TownTown event.town() | The town. |
PlayerEnteredDungeon
server.events().on_player_entered_dungeon(|event: & PlayerEnteredDungeon| ...)server.events().onPlayerEnteredDungeon((PlayerEnteredDungeon event) -> ...)
A player went down into a dungeon (when its banner shows).
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who entered. |
event.dungeon: DungeonDungeon event.dungeon() | The dungeon. |
PlayerAte
server.events().on_player_ate(|event: &mut PlayerAte| ...)server.events().onPlayerAte((PlayerAte event) -> ...)
A player ate or drank something.
Can be stopped: it is not eaten and stays in their hand.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who ate. |
event.item: ItemStackItemStack event.item() | What they ate. |
event.hunger: f64double event.hunger() / event.setHunger(...) changeable | Hunger it restores (health, for a healing potion). |
PlayerRested
server.events().on_player_rested(|event: &mut PlayerRested| ...)server.events().onPlayerRested((PlayerRested event) -> ...)
A player sitting by a campfire was healed a step.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who rested. |
event.amount: f64double event.amount() / event.setAmount(...) changeable | Health restored. |
BlockBreaking
server.events().on_block_breaking(|event: &mut BlockBreaking| ...)server.events().onBlockBreaking((BlockBreaking event) -> ...)
A player is about to break a block.
Can be stopped: the block stays.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who is breaking it. |
event.block: BlockBlock event.block() | The block and where it is. |
event.tool: Option<ItemStack>Optional<ItemStack> event.tool() | What they hold. |
event.drops: Vec<ItemStack>List<ItemStack> event.drops() / event.setDrops(...) changeable | What it will drop. |
BlockBroken
server.events().on_block_broken(|event: & BlockBroken| ...)server.events().onBlockBroken((BlockBroken event) -> ...)
A block was broken by a player.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who broke it. |
event.block: BlockBlock event.block() | What it was. |
BlockPlacing
server.events().on_block_placing(|event: &mut BlockPlacing| ...)server.events().onBlockPlacing((BlockPlacing event) -> ...)
A player is about to place a block.
Can be stopped: it is not placed and stays in their hand.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who is placing it. |
event.block: BlockBlock event.block() | The block and where it would go. |
BlockPlaced
server.events().on_block_placed(|event: & BlockPlaced| ...)server.events().onBlockPlaced((BlockPlaced event) -> ...)
A player placed a block.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who placed it. |
event.block: BlockBlock event.block() | The block. |
BlockChanged
server.events().on_block_changed(|event: & BlockChanged| ...)server.events().onBlockChanged((BlockChanged event) -> ...)
Any block changed that the world keeps, by anyone or anything: a player, water or lava flowing, sand falling, a plant growing, a plugin. Changes the world does not keep (a trap's spikes, falling snow, a boss room's lights) do not send it.
| Field | Description |
|---|---|
event.at: BlockPosBlockPos event.at() | Where. |
event.before: BlockTypeBlockType event.before() | What it was. |
event.after: BlockTypeBlockType event.after() | What it is now. |
ObjectPlacing
server.events().on_object_placing(|event: &mut ObjectPlacing| ...)server.events().onObjectPlacing((ObjectPlacing event) -> ...)
A player is about to place an object: furniture, a station, a chest, a bed, a door.
Can be stopped: it is not placed.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who is placing it. |
event.item: ItemTypeItemType event.item() | The object. |
event.at: BlockPosBlockPos event.at() | Where. |
ObjectRemoved
server.events().on_object_removed(|event: & ObjectRemoved| ...)server.events().onObjectRemoved((ObjectRemoved event) -> ...)
A placed object was taken down whole and dropped as an item (a server object made from a content pack's model drops nothing): broken by a player, or fallen with what held it up. An object a plugin removes without a drop does not send it.
| Field | Description |
|---|---|
event.player: Option<Player>Optional<Player> event.player() | Who took it down, if a player did. |
event.object: PlacedObjectPlacedObject event.object() | What it was (gone now: its handle reads nothing). |
ContainerOpening
server.events().on_container_opening(|event: &mut ContainerOpening| ...)server.events().onContainerOpening((ContainerOpening event) -> ...)
A player is opening a chest, barrel or other container.
Can be stopped: it stays shut.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who is opening it. |
event.container: PlacedObjectPlacedObject event.container() | The container. |
DoorUsed
server.events().on_door_used(|event: &mut DoorUsed| ...)server.events().onDoorUsed((DoorUsed event) -> ...)
A player opened or shut a door or gate.
Can be stopped: it stays as it was.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who used it. |
event.door: PlacedObjectPlacedObject event.door() | The door. |
event.opening: boolboolean event.opening() | True if opening. |
ItemPickingUp
server.events().on_item_picking_up(|event: &mut ItemPickingUp| ...)server.events().onItemPickingUp((ItemPickingUp event) -> ...)
A player is taking up a loose item.
Can be stopped: it stays where it is.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who is taking it. |
event.item: LooseItemLooseItem event.item() | The item on the ground. |
ItemDropped
server.events().on_item_dropped(|event: & ItemDropped| ...)server.events().onItemDropped((ItemDropped event) -> ...)
A player let go of or threw an item.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who dropped it. |
event.item: LooseItemLooseItem event.item() | The item, now loose. |
ItemCrafting
server.events().on_item_crafting(|event: &mut ItemCrafting| ...)server.events().onItemCrafting((ItemCrafting event) -> ...)
A finished piece is about to be taken off its station, the moment the craft is the taker's: a workbench's output, an anvil's or fletching bench's piece, a forge's ingot (by hand or tongs), food cooked on a campfire's rim. A brew bottled from a cauldron or a meal ladled from a pot does not send it yet.
Can be stopped: the piece stays on its station.
| Field | Description |
|---|---|
event.player: Option<Player>Optional<Player> event.player() | Who is taking it. |
event.station: StationStation event.station() | Which kind of station. |
event.result: ItemStackItemStack event.result() / event.setResult(...) changeable | What the taker gets (the station gives up its own piece all the same). |
ItemCrafted
server.events().on_item_crafted(|event: & ItemCrafted| ...)server.events().onItemCrafted((ItemCrafted event) -> ...)
A finished piece was taken off its station (after ItemCrafting).
| Field | Description |
|---|---|
event.player: Option<Player>Optional<Player> event.player() | Who took it. |
event.station: StationStation event.station() | Which kind of station. |
event.result: ItemStackItemStack event.result() | What it made. |
FishCaught
server.events().on_fish_caught(|event: &mut FishCaught| ...)server.events().onFishCaught((FishCaught event) -> ...)
A player landed a catch with a rod. A fish sends this before it lands, so its item can be changed, and a hooked Voxelmon sends it once it has landed. A fish speared with a trident does not send it yet.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who caught it. |
event.item: Option<ItemStack>Optional<ItemStack> event.item() / event.setItem(...) changeable | The item caught, if not a Voxelmon (one of it lands; none lands nothing). |
event.creature: Option<Creature>Optional<Creature> event.creature() | The Voxelmon hooked, if one was. |
LootRolled
server.events().on_loot_rolled(|event: &mut LootRolled| ...)server.events().onLootRolled((LootRolled event) -> ...)
Loot was chosen: a supply cache or a dungeon's cache broken, a chest filled as its town, dungeon or cave find is furnished, a wild Voxelmon's drops beaten in the world or in a battle (at most two stacks a beaten foe in a battle). Content packs' loot rules are added before plugins see it. A fishing catch sends FishCaught instead.
| Field | Description |
|---|---|
event.source: LootSourceLootSource event.source() | What it is for. |
event.player: Option<Player>Optional<Player> event.player() | Who it is for, if anyone. |
event.items: Vec<ItemStack>List<ItemStack> event.items() / event.setItems(...) changeable | The loot. |
CreatureSpawning
server.events().on_creature_spawning(|event: &mut CreatureSpawning| ...)server.events().onCreatureSpawning((CreatureSpawning event) -> ...)
A wild Voxelmon is about to appear, from the wild, a dungeon or a hive. It is sent on the tick the creature is made, before any player sees it. A den's pack, a hooked Voxelmon, a guardian and a plugin's own spawns do not send it yet. A content pack's spawn rule changes a wild one's species and level before plugins see it.
Can be stopped: it does not appear.
| Field | Description |
|---|---|
event.species: SpeciesSpecies event.species() / event.setSpecies(...) changeable | Its species. |
event.level: i64long event.level() / event.setLevel(...) changeable | Its level. |
event.place: PlacePlace event.place() | Where. |
event.reason: SpawnReasonSpawnReason event.reason() | The wild, a dungeon or a hive. |
CreatureSpawned
server.events().on_creature_spawned(|event: & CreatureSpawned| ...)server.events().onCreatureSpawned((CreatureSpawned event) -> ...)
A wild Voxelmon appeared.
CreatureDamaging
server.events().on_creature_damaging(|event: &mut CreatureDamaging| ...)server.events().onCreatureDamaging((CreatureDamaging event) -> ...)
A wild Voxelmon is about to be hurt in the world: by a player's blow, arrow or trident, a burn, a falling spike. Harm in a turn-based battle and a companion's blows in an action world do not send it yet.
Can be stopped: it takes no harm.
| Field | Description |
|---|---|
event.creature: CreatureCreature event.creature() | Who is hurt. |
event.amount: f64double event.amount() / event.setAmount(...) changeable | Health lost. |
event.player: Option<Player>Optional<Player> event.player() | The player whose blow, arrow or thrust did it. |
CreatureBeaten
server.events().on_creature_beaten(|event: &mut CreatureBeaten| ...)server.events().onCreatureBeaten((CreatureBeaten event) -> ...)
A wild Voxelmon was beaten: in a turn-based battle, or in the world by a player's blow. One knocked out by a companion in an action world does not send it yet.
| Field | Description |
|---|---|
event.creature: CreatureCreature event.creature() | The creature: readable during this event in a battle; one beaten in the world has already left it. |
event.player: Option<Player>Optional<Player> event.player() | Who beat it. |
event.experience: i64long event.experience() / event.setExperience(...) changeable | Experience the beater's team shares for it (a blow in the world gives none: 0, and a change there gives none). |
CaptureAttempt
server.events().on_capture_attempt(|event: &mut CaptureAttempt| ...)server.events().onCaptureAttempt((CaptureAttempt event) -> ...)
A cube thrown in the world is about to try to catch a Voxelmon. A cube used in a turn-based battle does not send it yet.
Can be stopped: the cube bounces off.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who threw it. |
event.creature: CreatureCreature event.creature() | The target. |
event.chance: f64double event.chance() / event.setChance(...) changeable | Its chance, 0 to 1. |
CreatureCaptured
server.events().on_creature_captured(|event: & CreatureCaptured| ...)server.events().onCreatureCaptured((CreatureCaptured event) -> ...)
A Voxelmon was caught.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who caught it. |
event.creature: CreatureCreature event.creature() | The creature, now theirs. |
CreatureLevelledUp
server.events().on_creature_levelled_up(|event: & CreatureLevelledUp| ...)server.events().onCreatureLevelledUp((CreatureLevelledUp event) -> ...)
A player's Voxelmon reached a new level.
| Field | Description |
|---|---|
event.creature: CreatureCreature event.creature() | The creature. |
event.level: i64long event.level() | Its new level. |
CreatureEvolving
server.events().on_creature_evolving(|event: &mut CreatureEvolving| ...)server.events().onCreatureEvolving((CreatureEvolving event) -> ...)
A player's Voxelmon is about to evolve.
Can be stopped: it does not evolve this time.
| Field | Description |
|---|---|
event.creature: CreatureCreature event.creature() | The creature. |
event.into: SpeciesSpecies event.into() | What it will become. |
CreatureEvolved
server.events().on_creature_evolved(|event: & CreatureEvolved| ...)server.events().onCreatureEvolved((CreatureEvolved event) -> ...)
A player's Voxelmon evolved.
| Field | Description |
|---|---|
event.creature: CreatureCreature event.creature() | The creature, now its new species. |
event.from: SpeciesSpecies event.from() | What it was. |
CompanionSentOut
server.events().on_companion_sent_out(|event: & CompanionSentOut| ...)server.events().onCompanionSentOut((CompanionSentOut event) -> ...)
A player threw a cube and their Voxelmon came out.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Its owner. |
event.creature: CreatureCreature event.creature() | The companion. |
CompanionRecalled
server.events().on_companion_recalled(|event: & CompanionRecalled| ...)server.events().onCompanionRecalled((CompanionRecalled event) -> ...)
A player's companion went back into its cube.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Its owner. |
event.creature: CreatureCreature event.creature() | The companion. |
CreaturePetted
server.events().on_creature_petted(|event: & CreaturePetted| ...)server.events().onCreaturePetted((CreaturePetted event) -> ...)
A player petted their companion.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who petted it. |
event.creature: CreatureCreature event.creature() | The companion. |
BattleStarting
server.events().on_battle_starting(|event: &mut BattleStarting| ...)server.events().onBattleStarting((BattleStarting event) -> ...)
A turn-based battle is about to begin, against a wild Voxelmon or a trainer.
Can be stopped: there is no battle.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who is battling. |
event.kind: BattleKindBattleKind event.kind() | Wild, trainer or boss. |
event.opponents: Vec<Creature>List<Creature> event.opponents() | What they face. |
BattleStarted
server.events().on_battle_started(|event: & BattleStarted| ...)server.events().onBattleStarted((BattleStarted event) -> ...)
A battle began.
BattleTurn
server.events().on_battle_turn(|event: & BattleTurn| ...)server.events().onBattleTurn((BattleTurn event) -> ...)
A battle's turn was decided.
| Field | Description |
|---|---|
event.battle: BattleBattle event.battle() | The battle. |
event.actions: Vec<TurnAction>List<TurnAction> event.actions() | What each side did. |
BattleEnded
server.events().on_battle_ended(|event: &mut BattleEnded| ...)server.events().onBattleEnded((BattleEnded event) -> ...)
A battle ended. It is sent when the result is decided (before the last turn's BattleTurn) or when the battle is called off.
| Field | Description |
|---|---|
event.battle: BattleBattle event.battle() | The battle (no longer readable: it has ended). |
event.result: BattleResultBattleResult event.result() | Won, lost, fled, caught or cancelled. |
event.coins: i64long event.coins() / event.setCoins(...) changeable | Coins paid by a beaten trainer. |
ProfessionLevelledUp
server.events().on_profession_levelled_up(|event: & ProfessionLevelledUp| ...)server.events().onProfessionLevelledUp((ProfessionLevelledUp event) -> ...)
A player reached a new level in a profession.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | The player. |
event.profession: ProfessionProfession event.profession() | Which profession. |
event.level: i64long event.level() | The new level. |
CoinsChanged
server.events().on_coins_changed(|event: & CoinsChanged| ...)server.events().onCoinsChanged((CoinsChanged event) -> ...)
A player's coins changed.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | The player. |
event.before: i64long event.before() | Coins before. |
event.after: i64long event.after() | Coins now. |
TownFreed
server.events().on_town_freed(|event: & TownFreed| ...)server.events().onTownFreed((TownFreed event) -> ...)
A town's Voxelord was beaten and the town freed.
| Field | Description |
|---|---|
event.town: TownTown event.town() | The town. |
event.players: Vec<Player>List<Player> event.players() | Who took part. |
DungeonBeaten
server.events().on_dungeon_beaten(|event: & DungeonBeaten| ...)server.events().onDungeonBeaten((DungeonBeaten event) -> ...)
A dungeon's guardian was beaten. players are those standing over the dungeon at that moment.
| Field | Description |
|---|---|
event.dungeon: DungeonDungeon event.dungeon() | The dungeon. |
event.players: Vec<Player>List<Player> event.players() | Who took part. |
DungeonReset
server.events().on_dungeon_reset(|event: & DungeonReset| ...)server.events().onDungeonReset((DungeonReset event) -> ...)
A beaten dungeon reset: at the first dawn a full day after its guardian fell, with no player inside, its chests refilled and its guardian will return; or through Dungeon.reset.
DayStarted
server.events().on_day_started(|event: & DayStarted| ...)server.events().onDayStarted((DayStarted event) -> ...)
Dawn: a new day began.
| Field | Description |
|---|---|
event.day: i64long event.day() | The day's number. |
NightStarted
server.events().on_night_started(|event: & NightStarted| ...)server.events().onNightStarted((NightStarted event) -> ...)
Dusk: night began.
| Field | Description |
|---|---|
event.day: i64long event.day() | The day's number. |
WeatherChanged
server.events().on_weather_changed(|event: & WeatherChanged| ...)server.events().onWeatherChanged((WeatherChanged event) -> ...)
The weather changed in kind or strength (World.weather), because a spell of weather began or ended or a plugin set it.
| Field | Description |
|---|---|
event.before: WeatherWeather event.before() | What it was. |
event.after: WeatherWeather event.after() | What it is now. |
WorldSaved
server.events().on_world_saved(|event: & WorldSaved| ...)server.events().onWorldSaved((WorldSaved event) -> ...)
The world was saved.
| Field | Description |
|---|---|
event.automatic: boolboolean event.automatic() | True for an autosave. |
MenuPressed
server.events().on_menu_pressed(|event: & MenuPressed| ...)server.events().onMenuPressed((MenuPressed event) -> ...)
A player pressed a button, tile or toggle on a plugin's Menu.
| Field | Description |
|---|---|
event.player: PlayerPlayer event.player() | Who pressed it. |
event.menu: MenuMenu event.menu() | The menu. |
event.id: StringString event.id() | The pressed element's id. |
event.value: Option<Value>Optional<Value> event.value() | A toggle's or slider's new value. |
MenuClosed
server.events().on_menu_closed(|event: & MenuClosed| ...)server.events().onMenuClosed((MenuClosed event) -> ...)
A player closed a plugin's menu, or walked away from it.