Class Event

java.lang.Object
net.risingworld.api.events.Event
Direct Known Subclasses:
AddAdminEvent, ExplosionEvent, InputEvent, ItemTransformEvent, LateUpdateEvent, MetaObjectEvent, NpcAddClothesEvent, NpcAddSaddleBagEvent, NpcAddSaddleEvent, NpcDamageEvent, NpcDeathEvent, NpcHitNpcEvent, NpcRemoveClothesEvent, NpcRemoveSaddleBagEvent, NpcRemoveSaddleEvent, NpcSpawnEvent, NpcTransformEvent, PlantGrowthEvent, PlayerEvent, ProjectileFireEvent, ProjectileHitEvent, ReadyEvent, RemoveAdminEvent, SeasonChangeEvent, ShutdownEvent, SkipNightEvent, UpdateEvent, WeatherChangeEvent

public abstract class Event extends Object
Base class for all events.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    Only relevant for cancellable events (see Cancellable interface)
    protected long
    Pointer to the native event
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
     
    final boolean
    Checks if the event is still valid.
    In general, events have a very short life cycle - they're only valid the moment they're triggered.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • pointer

      protected long pointer
      Pointer to the native event
    • cancelled

      protected boolean cancelled
      Only relevant for cancellable events (see Cancellable interface)
  • Constructor Details

    • Event

      protected Event()
  • Method Details

    • isValid

      public final boolean isValid()
      Checks if the event is still valid.
      In general, events have a very short life cycle - they're only valid the moment they're triggered. At the end of the frame, their pointer is set to null (and the native resource gets disposed), so they can no longer be used.
      You must not use event instances outside the particular listener methods! For example, never store them in a list or access them from another thread.

      Note: This is only relevant for built-in events! When using your custom events (classes derived from Event), you can ignore this method.
      Returns:
      true if the event is still valid (and can be used), false if not
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object