Skip to main content
Lode Items fires normal Bukkit events from the org.lodemc.api.event package. Listen to them with @EventHandler in any registered Listener, like any other event. They all fire on the main thread. Every cancellable event has the usual isCancelled() and setCancelled(boolean).

CustomBlockPlaceEvent

A player placed a custom block, crops included. It fires during Bukkit’s BlockPlaceEvent, at HIGHEST priority, so protection plugins have already allowed it. The block is already in place. Cancelling it cancels the BlockPlaceEvent, which takes the block back and leaves the item in the player’s hand.

CustomBlockBreakEvent

A player is breaking a custom block, crops included. It fires during Bukkit’s BlockBreakEvent, at HIGHEST priority, while the block is still there. Cancelling it cancels the BlockBreakEvent, so the block stays. To change the exact items that drop, use Bukkit’s BlockDropItemEvent.

PropPlaceEvent

A prop is about to be placed: by a player, after protection plugins allowed it; by /lodeitems prop place; or by LodeProps.place. Nothing is in the world yet. Cancel it to stop the placing. A player keeps the item.

PropBreakEvent

A prop is about to break: a player’s hits, after protection plugins allowed it, or PlacedProp.breakNaturally. Cancel it to keep the piece. Storage contents and a jukebox’s disc spill out whatever you do with the drops.

PropInteractEvent

A player right-clicked one of a prop’s hitboxes, before the prop does anything: sit, sleep, open storage, open a door, switch state. Protection plugins have already allowed the click. Cancel it and the prop does nothing, and the click is used up, so nothing is placed against it either. It doesn’t fire when a player sneaks with an item in hand, because that builds against the prop instead of using it.

PropStateChangeEvent

A prop is switching from one of its states: to another: a player’s click, a state’s next-after or reset-after timer, or PlacedProp.setState. Cancel it to keep the current state.

Crop events in order

When a crop grows by itself:
  1. Every crop rule’s growthChance runs.
  2. CropGrowAttemptEvent fires with the chance the rules returned. Cancel it or change the chance.
  3. The chance is rolled. If it fails, nothing more happens this tick.
  4. CropGrowEvent fires with cause NATURAL. Cancel it or change the stage.
  5. Bukkit’s BlockGrowEvent fires, as it does for vanilla wheat. Cancelling it also stops the growth.
Bone meal and plugins skip steps 1 to 3 and 5: they fire only CropGrowEvent, with cause BONE_MEAL or PLUGIN.

CropGrowAttemptEvent

A crop that isn’t ripe got a growth tick, and is about to roll chance to grow one stage. Ripe crops don’t get growth ticks. Crops get growth ticks often, so Lode Items only creates this event while at least one plugin listens to it. If you only change the chance and don’t need the block or a player, a crop rule does the same job more cheaply.

CropGrowEvent

A crop is about to change from stage from to stage to. Fires for natural growth, bone meal and plugins.
To stop bone meal working without using it up, return false from a rule’s canBoneMeal instead of cancelling this event.

CropHarvestEvent

A ripe crop is about to be picked: a player right-clicked it with harvest: on, or a plugin called LodeCrops.harvest.
Breaking a crop isn’t a harvest. Use Bukkit’s BlockBreakEvent and BlockDropItemEvent for that, and check the block with LodeCrops.at first.

LodeItemsLoadEvent

Lode Items has loaded its content: once when the server starts and again after every /lodeitems reload. Items, blocks and crops may have been added, changed or removed, so look up again anything you got from the API before, such as CustomCrop objects. The first load happens while Lode Items enables, before your plugin’s onEnable, so your listener won’t see it. Set things up in onEnable and use this event for reloads.
Crop rules, config keys, types and pack contributors stay registered across reloads, so you don’t need to add them again.

PackBuiltEvent

The resource pack was built: when the server starts and on every reload. It fires right after LodeItemsLoadEvent. Use it to copy the pack somewhere else, or upload it to your own host. To add files to the pack, use a contributor instead. Like LodeItemsLoadEvent, the first build happens before your onEnable, so you only see rebuilds.

Vanilla events

These Bukkit events fire for custom blocks and crops as they do for vanilla ones. Bukkit reports a generic Material for custom blocks, so use LodeItemsApi.blockId or LodeCrops.at to tell them apart.