Class EnergyNodeChangeEvent

java.lang.Object
org.bukkit.event.Event
com.github.darksoulq.abyssallib.server.event.custom.energy.EnergyNodeChangeEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public final class EnergyNodeChangeEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
Fired whenever the internal energy level of an EnergyNode changes due to insertion, extraction, or capacity adjustments.

Note: While this event is Cancellable, its implementation in the abstract node primarily serves as a notification; logic depends on implementation handling.

  • Constructor Details

    • EnergyNodeChangeEvent

      public EnergyNodeChangeEvent(EnergyNode node, EnergyUnit unit, double previous, double current, boolean async)
      Constructs a new EnergyNodeChangeEvent.
      Parameters:
      node - The affected EnergyNode.
      unit - The EnergyUnit of the energy values.
      previous - The amount of energy held prior to the update.
      current - The new amount of energy held.
      async - Whether the change occurred off the primary server thread.
  • Method Details

    • getNode

      public EnergyNode getNode()
      Returns:
      The EnergyNode that underwent a change.
    • getUnit

      public EnergyUnit getUnit()
      Returns:
      The EnergyUnit the change is measured in.
    • getPrevious

      public double getPrevious()
      Returns:
      The energy value before the operation.
    • getCurrent

      public double getCurrent()
      Returns:
      The energy value after the operation.
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
      Returns:
      True if the change event is cancelled.
    • setCancelled

      public void setCancelled(boolean cancel)
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
      Parameters:
      cancel - True to signal that this change should be ignored or reverted.
    • getHandlers

      public org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
      Returns:
      The specific HandlerList for this event.
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
      Returns:
      The static HandlerList required for Bukkit events.