Skip to content
Matryoshika edited this page May 26, 2018 · 1 revision

Parent Events

Parent events are events that are extended by several other events, and thus when a child event is fired, their parent(s) events are also fired. Scripter does not subscribe to parent events, only the outer-most child events, meaning you cannot have a script associated with a parent event.

However, child events contain information passed down from their parent events, meaning that fields and methods available in parent events are also available in the child events.

Scripter is set to recieve events first for all subscribed events, by having the EventPriority set to Highest. In the case of another mod doing the same, they will be sorted alphabetically by mod-id.


Event

Event is the one common Event that all other Events are based off of. Available methods are:

  • isCancelable (returns boolean) Determines if this function is cancelable at all.
  • isCanceled (returns boolean) Determine if this event is canceled and should stop executing.
  • setCanceled (returns void, expects boolean) Sets the cancel state of this event. Note, not all events are cancelable, and any attempt to invoke this method on an event that is not cancelable (as determined by #isCancelable will result in an UnsupportedOperationException).
  • hasResult (returns boolean) Determines if this event expects a significant result value.
  • getResult (returns Result) Returns the value set as the result of this event.
  • setResult (returns void, expects Result) Sets the result value for this event, not all events can have a result set, and any attempt to set a result for a event that isn't expecting it will result in a IllegalArgumentException.
  • getListenerList (Returns ListenerList) Returns a ListenerList object that contains all listeners that are registered to this event.
Clone this wiki locally