Class NpcLeaveAreaEvent

java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.npc.NpcLeaveAreaEvent

public final class NpcLeaveAreaEvent extends Event
Called when an npc leaves an Area. This event is not cancellable, use Npc.setPosition(Vector3f) or Npc.moveTo(Vector3f) if you want to keep the npc inside the area.

Note: Npcs are only simulated in proximity to players, so this event is only triggered for npcs which are actually moving (i.e npcs near a player). The areas of an npc are tracked as long as at least one plugin listens for this event (or for the NpcEnterAreaEvent). If an area is removed, this event is not triggered.

If a plugin teleports the npc out of the area while handling the NpcEnterAreaEvent, this event is triggered immediately. In this case, the old npc position is the position before the npc entered the area (i.e. it is outside the area).
See Also:
  • Method Details

    • getNpc

      public Npc getNpc()
      Gets the npc that left the area.
      Returns:
      the npc.
    • getArea

      public Area getArea()
      Gets the Area the npc has left.
      Returns:
      the Area.
    • getNewNpcPosition

      public Vector3f getNewNpcPosition()
      Gets the new npc position (outside the area).
      Returns:
      the new npc position.
    • getOldNpcPosition

      public Vector3f getOldNpcPosition()
      Gets the previous npc position (usually still inside the area, see class description).
      Returns:
      the old npc position.