Class EggEvent

java.lang.Object
valorless.rarespawns.events.EggEvent
All Implemented Interfaces:
org.bukkit.event.Listener

public class EggEvent extends Object implements 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Registers the EggEvent listener with the Bukkit plugin manager.
    void
    onPlayerEggThrow(org.bukkit.event.player.PlayerEggThrowEvent event)
    Handles PlayerEggThrowEvent and applies hatch configuration for rare items.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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