Class EnchantmentEffectListener
- All Implemented Interfaces:
org.bukkit.event.Listener
EffectDispatchSpine.
For each supported Bukkit event, this listener extracts the relevant item,
queries custom enchantments via ItemEnchantmentService, and dispatches
effects through the spine so that typed callbacks and event bus listeners execute.
-
Constructor Summary
ConstructorsConstructorDescriptionEnchantmentEffectListener(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull EffectDispatchSpine spine, @NotNull ItemEnchantmentService itemService) Creates a new enchantment effect listener. -
Method Summary
Modifier and TypeMethodDescriptionvoidonBlockBreak(org.bukkit.event.block.BlockBreakEvent event) Handles block break events, dispatching enchantment effects for the tool used to break the block.voidonBlockPlace(org.bukkit.event.block.BlockPlaceEvent event) Handles block place events, dispatching enchantment effects for the item used to place the block.voidonEntityDamage(org.bukkit.event.entity.EntityDamageEvent event) Handles general entity damage events for armor and shield enchantments.voidonEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event) Handles entity damage by entity events, dispatching enchantment effects for weapons held by the attacking player.voidonEntityPickupItem(org.bukkit.event.entity.EntityPickupItemEvent event) Handles entity pickup item events, dispatching enchantment effects for the item being picked up.voidonEntityShootBow(org.bukkit.event.entity.EntityShootBowEvent event) Handles entity shoot bow events, dispatching enchantment effects for the bow used to shoot the arrow.voidonPlayerDropItem(org.bukkit.event.player.PlayerDropItemEvent event) Handles player drop item events, dispatching enchantment effects for the item being dropped.voidonPlayerFish(org.bukkit.event.player.PlayerFishEvent event) Handles player fishing events, dispatching enchantment effects for the fishing rod in the main hand.voidonPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event) Handles player interact events with blocks, dispatching enchantment effects for the item in the interacting hand.voidonPlayerInteractEntity(org.bukkit.event.player.PlayerInteractEntityEvent event) Handles player interact entity events, dispatching enchantment effects for the item in the interacting hand.voidonPlayerItemConsume(org.bukkit.event.player.PlayerItemConsumeEvent event) Handles player item consume events, dispatching enchantment effects for the item being consumed.voidonPlayerItemDamage(org.bukkit.event.player.PlayerItemDamageEvent event) Handles player item damage events, dispatching enchantment effects for the item taking durability damage.voidonProjectileHit(org.bukkit.event.entity.ProjectileHitEvent event) Handles projectile hit events, dispatching enchantment effects for the item used to launch the projectile.voidonProjectileLaunch(org.bukkit.event.entity.ProjectileLaunchEvent event) Handles projectile launch events, dispatching enchantment effects for the item used to launch the projectile (e.g., bow, crossbow, snowball).
-
Constructor Details
-
EnchantmentEffectListener
public EnchantmentEffectListener(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull EffectDispatchSpine spine, @NotNull @NotNull ItemEnchantmentService itemService) Creates a new enchantment effect listener.- Parameters:
plugin- the owning plugin for registration contextspine- the dispatch spine for firing enchantment effectsitemService- the item enchantment service for querying item enchantments- Since:
- 1.0.0
-
-
Method Details
-
onEntityDamageByEntity
public void onEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event) Handles entity damage by entity events, dispatching enchantment effects for weapons held by the attacking player.Creates and dispatches a
EffectDispatchSpine.DispatchEventType.ENTITY_DAMAGE_BY_ENTITYcontext for enchantments on the main hand weapon.- Parameters:
event- the damage event- Since:
- 1.0.0
-
onEntityDamage
public void onEntityDamage(org.bukkit.event.entity.EntityDamageEvent event) Handles general entity damage events for armor and shield enchantments.- Parameters:
event- the damage event- Since:
- 1.0.0
-
onBlockBreak
public void onBlockBreak(org.bukkit.event.block.BlockBreakEvent event) Handles block break events, dispatching enchantment effects for the tool used to break the block.Creates and dispatches a
EffectDispatchSpine.DispatchEventType.BLOCK_BREAKcontext for enchantments on the main hand tool.- Parameters:
event- the block break event- Since:
- 1.0.0
-
onBlockPlace
public void onBlockPlace(org.bukkit.event.block.BlockPlaceEvent event) Handles block place events, dispatching enchantment effects for the item used to place the block.Creates and dispatches a
EffectDispatchSpine.DispatchEventType.BLOCK_PLACEcontext for enchantments on the main hand item.- Parameters:
event- the block place event- Since:
- 1.0.0
-
onPlayerInteract
public void onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event) Handles player interact events with blocks, dispatching enchantment effects for the item in the interacting hand.Creates and dispatches a
EffectDispatchSpine.DispatchEventType.BLOCK_INTERACTcontext for enchantments on the interacting hand. Only processes left and right click block actions.- Parameters:
event- the player interact event- Since:
- 1.0.0
-
onPlayerInteractEntity
public void onPlayerInteractEntity(org.bukkit.event.player.PlayerInteractEntityEvent event) Handles player interact entity events, dispatching enchantment effects for the item in the interacting hand.Creates and dispatches a
EffectDispatchSpine.DispatchEventType.ENTITY_INTERACTcontext for enchantments on the hand used to interact with the entity.- Parameters:
event- the player interact entity event- Since:
- 1.0.0
-
onProjectileLaunch
public void onProjectileLaunch(org.bukkit.event.entity.ProjectileLaunchEvent event) Handles projectile launch events, dispatching enchantment effects for the item used to launch the projectile (e.g., bow, crossbow, snowball).Creates and dispatches a
EffectDispatchSpine.DispatchEventType.PROJECTILE_LAUNCHcontext for enchantments on the main or off hand item. Only processes projectiles launched by players.- Parameters:
event- the projectile launch event- Since:
- 1.0.0
-
onProjectileHit
public void onProjectileHit(org.bukkit.event.entity.ProjectileHitEvent event) Handles projectile hit events, dispatching enchantment effects for the item used to launch the projectile.Creates and dispatches a
EffectDispatchSpine.DispatchEventType.PROJECTILE_HITcontext for enchantments on the main or off hand item. Only processes projectiles shot by players.- Parameters:
event- the projectile hit event- Since:
- 1.0.0
-
onPlayerFish
public void onPlayerFish(org.bukkit.event.player.PlayerFishEvent event) Handles player fishing events, dispatching enchantment effects for the fishing rod in the main hand.Creates and dispatches a
EffectDispatchSpine.DispatchEventType.FISHING_ACTIONcontext for enchantments on the fishing rod.- Parameters:
event- the player fish event- Since:
- 1.0.0
-
onEntityShootBow
public void onEntityShootBow(org.bukkit.event.entity.EntityShootBowEvent event) Handles entity shoot bow events, dispatching enchantment effects for the bow used to shoot the arrow.Creates and dispatches a
EffectDispatchSpine.DispatchEventType.BOW_SHOOTcontext for enchantments on the bow. Detects whether the bow was in the main or off hand and dispatches accordingly. Only processes bows shot by players.- Parameters:
event- the entity shoot bow event- Since:
- 1.0.0
-
onPlayerItemConsume
public void onPlayerItemConsume(org.bukkit.event.player.PlayerItemConsumeEvent event) Handles player item consume events, dispatching enchantment effects for the item being consumed.Creates and dispatches a
EffectDispatchSpine.DispatchEventType.ITEM_CONSUMEcontext for enchantments on the consumed item.- Parameters:
event- the player item consume event- Since:
- 1.0.0
-
onPlayerItemDamage
public void onPlayerItemDamage(org.bukkit.event.player.PlayerItemDamageEvent event) Handles player item damage events, dispatching enchantment effects for the item taking durability damage.Creates and dispatches a
EffectDispatchSpine.DispatchEventType.DURABILITY_DAMAGEcontext for enchantments on the damaged item.- Parameters:
event- the player item damage event- Since:
- 1.0.0
-
onPlayerDropItem
public void onPlayerDropItem(org.bukkit.event.player.PlayerDropItemEvent event) Handles player drop item events, dispatching enchantment effects for the item being dropped.Creates and dispatches a
EffectDispatchSpine.DispatchEventType.ITEM_DROPcontext for enchantments on the dropped item.- Parameters:
event- the player drop item event- Since:
- 1.0.0
-
onEntityPickupItem
public void onEntityPickupItem(org.bukkit.event.entity.EntityPickupItemEvent event) Handles entity pickup item events, dispatching enchantment effects for the item being picked up.Creates and dispatches a
EffectDispatchSpine.DispatchEventType.ITEM_PICKUPcontext for enchantments on the picked up item. Only processes pickups by players.- Parameters:
event- the entity pickup item event- Since:
- 1.0.0
-