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’sBlockPlaceEvent, 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’sBlockBreakEvent, 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, orPlacedProp.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 itsstates: 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:- Every crop rule’s
growthChanceruns. CropGrowAttemptEventfires with the chance the rules returned. Cancel it or change the chance.- The chance is rolled. If it fails, nothing more happens this tick.
CropGrowEventfires with causeNATURAL. Cancel it or change the stage.- Bukkit’s
BlockGrowEventfires, as it does for vanilla wheat. Cancelling it also stops the growth.
CropGrowEvent, with cause BONE_MEAL or PLUGIN.
CropGrowAttemptEvent
A crop that isn’t ripe got a growth tick, and is about to rollchance 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 stagefrom to stage to. Fires for natural growth, bone meal and plugins.
CropHarvestEvent
A ripe crop is about to be picked: a player right-clicked it withharvest: on, or a plugin called LodeCrops.harvest.
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.
PackBuiltEvent
The resource pack was built: when the server starts and on every reload. It fires right afterLodeItemsLoadEvent.
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 genericMaterial for custom blocks, so use LodeItemsApi.blockId or LodeCrops.at to tell them apart.
