Package valorless.rarespawns.events
Class EggEvent
java.lang.Object
valorless.rarespawns.events.EggEvent
- All Implemented Interfaces:
org.bukkit.event.Listener
Listener that customizes egg hatching behavior when using RareSpawns items.
When a thrown egg item is recognized as a RareSpawns item, this handler reads hatch settings from its ItemData (hatch, hatchType, hatchAmount) and applies them to the PlayerEggThrowEvent.
Register this listener by calling init() during plugin startup.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidinit()Registers the EggEvent listener with the Bukkit plugin manager.voidonPlayerEggThrow(org.bukkit.event.player.PlayerEggThrowEvent event) Handles PlayerEggThrowEvent and applies hatch configuration for rare items.
-
Constructor Details
-
EggEvent
public EggEvent()
-
-
Method Details
-
init
public static void init()Registers the EggEvent listener with the Bukkit plugin manager. -
onPlayerEggThrow
public void onPlayerEggThrow(org.bukkit.event.player.PlayerEggThrowEvent event) Handles PlayerEggThrowEvent and applies hatch configuration for rare items.If the egg's ItemStack is tagged as a RareSpawns item, reads its ItemData:
- hatch: when true, force the egg to hatch
- hatchType: optional entity type to hatch (string name)
- hatchAmount: optional number of entities to hatch
- eggSound: optional sound played when thrown
- Parameters:
event- the egg throw event fired by Bukkit
-