Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.event.Event Class Referenceabstract
Inheritance diagram for org.bukkit.event.Event:
org.bukkit.event.block.BlockEvent org.bukkit.event.entity.EntityEvent org.bukkit.event.entity.PlayerLeashEntityEvent org.bukkit.event.hanging.HangingEvent org.bukkit.event.inventory.InventoryEvent org.bukkit.event.inventory.InventoryMoveItemEvent org.bukkit.event.inventory.InventoryPickupItemEvent org.bukkit.event.painting.PaintingEvent org.bukkit.event.player.AsyncPlayerPreLoginEvent org.bukkit.event.player.PlayerEvent org.bukkit.event.player.PlayerPreLoginEvent org.bukkit.event.server.ServerEvent org.bukkit.event.TestEvent org.bukkit.event.vehicle.VehicleEvent org.bukkit.event.weather.WeatherEvent org.bukkit.event.world.WorldEvent

Classes

enum  Result
 

Public Member Functions

 Event ()
 
 Event (boolean isAsync)
 
String getEventName ()
 
abstract HandlerList getHandlers ()
 
final boolean isAsynchronous ()
 

Detailed Description

Represents an event.

See also
PluginManager::callEvent(Event)
PluginManager::registerEvents(Listener,Plugin)

Definition at line 11 of file Event.java.

Constructor & Destructor Documentation

org.bukkit.event.Event.Event ( )

The default constructor is defined for cleaner code. This constructor assumes the event is synchronous.

Definition at line 19 of file Event.java.

19  {
20  this(false);
21  }
org.bukkit.event.Event.Event ( boolean  isAsync)

This constructor is used to explicitly declare an event as synchronous or asynchronous.

Parameters
isAsynctrue indicates the event will fire asynchronously, false by default from default constructor

Definition at line 30 of file Event.java.

30  {
31  this.async = isAsync;
32  }

Member Function Documentation

String org.bukkit.event.Event.getEventName ( )

Convenience method for providing a user-friendly identifier. By default, it is the event's class's Class::getSimpleName() simple name}.

Returns
name of this event

Definition at line 41 of file Event.java.

Referenced by org.bukkit.plugin.SimplePluginManager.callEvent().

41  {
42  if (name == null) {
43  name = getClass().getSimpleName();
44  }
45  return name;
46  }
final boolean org.bukkit.event.Event.isAsynchronous ( )

Any custom event that should not by synchronized with other events must use the specific constructor. These are the caveats of using an asynchronous event:

  • The event is never fired from inside code triggered by a synchronous event. Attempting to do so results in an java.lang.IllegalStateException.
  • However, asynchronous event handlers may fire synchronous or asynchronous events
  • The event may be fired multiple times simultaneously and in any order.
  • Any newly registered or unregistered handler is ignored after an event starts execution.
  • The handlers for this event may block for any length of time.
  • Some implementations may selectively declare a specific event use as asynchronous. This behavior should be clearly defined.
  • Asynchronous calls are not calculated in the plugin timing system.
Returns
false by default, true if the event fires asynchronously

Definition at line 72 of file Event.java.

Referenced by org.bukkit.plugin.SimplePluginManager.callEvent().

72  {
73  return async;
74  }

The documentation for this class was generated from the following file: