13
0
geforkt von Mirrors/Paper

[Bleeding] Changed event system into a new, much faster design. Huge thanks to @zml2008 & @lahwran.

By: Nathan Adams <dinnerbone@dinnerbone.com>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2012-01-16 18:25:17 +00:00
Ursprung 94bc6ec0e6
Commit e0c7fc6bf5
132 geänderte Dateien mit 1691 neuen und 225 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,9 @@ import org.bukkit.event.Listener;
/** /**
* Handles all custom events * Handles all custom events
*/ */
@Deprecated
public class CustomEventListener implements Listener { public class CustomEventListener implements Listener {
private static final HandlerList handlers = new HandlerList();
public CustomEventListener() {} public CustomEventListener() {}
/** /**

Datei anzeigen

@ -1,14 +1,27 @@
package org.bukkit.event; package org.bukkit.event;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.entity.Projectile; import org.bukkit.event.block.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.inventory.*;
import org.bukkit.event.painting.*;
import org.bukkit.event.player.*;
import org.bukkit.event.server.*;
import org.bukkit.event.vehicle.*;
import org.bukkit.event.weather.*;
import org.bukkit.event.world.*;
/** /**
* Represents an event * Represents an event
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public abstract class Event implements Serializable { public abstract class Event implements Serializable {
@Deprecated
private final static Map<String, HandlerList> customHandlers = new HashMap<String, HandlerList>();
@Deprecated
private final Type type; private final Type type;
private final String name; private final String name;
@ -16,7 +29,12 @@ public abstract class Event implements Serializable {
exAssert(type != null, "type is null"); exAssert(type != null, "type is null");
exAssert(type != Type.CUSTOM_EVENT, "use Event(String) to make custom events"); exAssert(type != Type.CUSTOM_EVENT, "use Event(String) to make custom events");
this.type = type; this.type = type;
this.name = null; this.name = getClass().getName();
}
protected Event() {
this.type = Type.FIXED_EVENT;
this.name = getClass().getName();
} }
protected Event(final String name) { protected Event(final String name) {
@ -30,6 +48,7 @@ public abstract class Event implements Serializable {
* *
* @return Event type that this object represents * @return Event type that this object represents
*/ */
@Deprecated
public final Type getType() { public final Type getType() {
return type; return type;
} }
@ -46,47 +65,73 @@ public abstract class Event implements Serializable {
* @return Name of this event * @return Name of this event
*/ */
public final String getEventName() { public final String getEventName() {
return (type != Type.CUSTOM_EVENT) ? type.toString() : name; return name;
}
public HandlerList getHandlers() {
if (type == Type.CUSTOM_EVENT) {
HandlerList result = customHandlers.get(getEventName());
if (result == null) {
result = new HandlerList();
customHandlers.put(getEventName(), result);
}
return result;
} else {
throw new IllegalStateException("Event must implement getHandlers()");
}
} }
/** /**
* Represents an events priority in execution * Represents an events priority in execution
*/ */
@Deprecated
public enum Priority { public enum Priority {
/** /**
* Event call is of very low importance and should be ran first, to allow * Event call is of very low importance and should be ran first, to allow
* other plugins to further customise the outcome * other plugins to further customise the outcome
*/ */
Lowest, Lowest(EventPriority.LOWEST),
/** /**
* Event call is of low importance * Event call is of low importance
*/ */
Low, Low(EventPriority.LOW),
/** /**
* Event call is neither important or unimportant, and may be ran normally * Event call is neither important or unimportant, and may be ran normally
*/ */
Normal, Normal(EventPriority.NORMAL),
/** /**
* Event call is of high importance * Event call is of high importance
*/ */
High, High(EventPriority.HIGH),
/** /**
* Event call is critical and must have the final say in what happens * Event call is critical and must have the final say in what happens
* to the event * to the event
*/ */
Highest, Highest(EventPriority.HIGHEST),
/** /**
* Event is listened to purely for monitoring the outcome of an event. * Event is listened to purely for monitoring the outcome of an event.
* <p /> * <p />
* No modifications to the event should be made under this priority * No modifications to the event should be made under this priority
*/ */
Monitor Monitor(EventPriority.MONITOR);
private final EventPriority priority;
private Priority(EventPriority priority) {
this.priority = priority;
}
public EventPriority getNewPriority() {
return priority;
}
} }
/** /**
* Represents a category used by Type * Represents a category used by Type
*/ */
@Deprecated
public enum Category { public enum Category {
/** /**
@ -136,6 +181,7 @@ public abstract class Event implements Serializable {
/** /**
* Provides a lookup for all core events * Provides a lookup for all core events
*/ */
@Deprecated
public enum Type { public enum Type {
/** /**
@ -147,178 +193,176 @@ public abstract class Event implements Serializable {
* *
* @see org.bukkit.event.player.PlayerJoinEvent * @see org.bukkit.event.player.PlayerJoinEvent
*/ */
PLAYER_JOIN(Category.PLAYER), PLAYER_JOIN(Category.PLAYER, PlayerJoinEvent.class),
/** /**
* Called when a player is attempting to connect to the server * Called when a player is attempting to connect to the server
* *
* @see org.bukkit.event.player.PlayerLoginEvent * @see org.bukkit.event.player.PlayerLoginEvent
*/ */
PLAYER_LOGIN(Category.PLAYER), PLAYER_LOGIN(Category.PLAYER, PlayerLoginEvent.class),
/** /**
* Called when a player has just been authenticated * Called when a player has just been authenticated
* *
* @see org.bukkit.event.player.PlayerPreLoginEvent * @see org.bukkit.event.player.PlayerPreLoginEvent
*/ */
PLAYER_PRELOGIN(Category.PLAYER), PLAYER_PRELOGIN(Category.PLAYER, PlayerPreLoginEvent.class),
/** /**
* Called when a player respawns * Called when a player respawns
* *
* @see org.bukkit.event.player.PlayerRespawnEvent * @see org.bukkit.event.player.PlayerRespawnEvent
*/ */
PLAYER_RESPAWN(Category.PLAYER), PLAYER_RESPAWN(Category.PLAYER, PlayerRespawnEvent.class),
/** /**
* Called when a player gets kicked from the server * Called when a player gets kicked from the server
* *
* @see org.bukkit.event.player.PlayerKickEvent * @see org.bukkit.event.player.PlayerKickEvent
*/ */
PLAYER_KICK(Category.PLAYER), PLAYER_KICK(Category.PLAYER, PlayerKickEvent.class),
/** /**
* Called when a player sends a chat message * Called when a player sends a chat message
* *
* @see org.bukkit.event.player.PlayerChatEvent * @see org.bukkit.event.player.PlayerChatEvent
*/ */
PLAYER_CHAT(Category.PLAYER), PLAYER_CHAT(Category.PLAYER, PlayerChatEvent.class),
/** /**
* Called when a player uses a command (early in the command handling process) * Called when a player uses a command (early in the command handling process)
* *
* @see org.bukkit.event.player.PlayerCommandPreprocessEvent * @see org.bukkit.event.player.PlayerCommandPreprocessEvent
*/ */
PLAYER_COMMAND_PREPROCESS(Category.PLAYER), PLAYER_COMMAND_PREPROCESS(Category.PLAYER, PlayerCommandPreprocessEvent.class),
/** /**
* Called when a player leaves the server * Called when a player leaves the server
* *
* @see org.bukkit.event.player.PlayerQuitEvent * @see org.bukkit.event.player.PlayerQuitEvent
*/ */
PLAYER_QUIT(Category.PLAYER), PLAYER_QUIT(Category.PLAYER, PlayerQuitEvent.class),
/** /**
* Called when a player moves position in the world * Called when a player moves position in the world
* *
* @see org.bukkit.event.player.PlayerMoveEvent * @see org.bukkit.event.player.PlayerMoveEvent
*/ */
PLAYER_MOVE(Category.PLAYER), PLAYER_MOVE(Category.PLAYER, PlayerMoveEvent.class),
/** /**
* Called before a player gets a velocity vector sent, which will instruct him to * Called before a player gets a velocity vector sent, which will instruct him to
* get "pushed" into a specific direction, e.g. after an explosion * get "pushed" into a specific direction, e.g. after an explosion
* *
* @see org.bukkit.event.player.PlayerVelocityEvent * @see org.bukkit.event.player.PlayerVelocityEvent
*/ */
PLAYER_VELOCITY(Category.PLAYER), PLAYER_VELOCITY(Category.PLAYER, PlayerVelocityEvent.class),
/** /**
* Called when a player undergoes an animation (Arm Swing is the only animation currently supported) * Called when a player undergoes an animation (Arm Swing is the only animation currently supported)
* *
* @see org.bukkit.event.player.PlayerAnimationEvent * @see org.bukkit.event.player.PlayerAnimationEvent
*/ */
PLAYER_ANIMATION(Category.PLAYER), PLAYER_ANIMATION(Category.PLAYER, PlayerAnimationEvent.class),
/** /**
* Called when a player toggles sneak mode * Called when a player toggles sneak mode
* *
* @see org.bukkit.event.player.PlayerToggleSneakEvent * @see org.bukkit.event.player.PlayerToggleSneakEvent
*/ */
PLAYER_TOGGLE_SNEAK(Category.PLAYER), PLAYER_TOGGLE_SNEAK(Category.PLAYER, PlayerToggleSneakEvent.class),
/** /**
* Called when a player toggles sprint mode * Called when a player toggles sprint mode
* *
* @see org.bukkit.event.player.PlayerToggleSprintEvent * @see org.bukkit.event.player.PlayerToggleSprintEvent
*/ */
PLAYER_TOGGLE_SPRINT(Category.PLAYER), PLAYER_TOGGLE_SPRINT(Category.PLAYER, PlayerToggleSprintEvent.class),
/** /**
* Called when a player interacts with an object or air * Called when a player interacts with an object or air
* *
* @see org.bukkit.event.player.PlayerInteractEvent * @see org.bukkit.event.player.PlayerInteractEvent
*/ */
PLAYER_INTERACT(Category.PLAYER), PLAYER_INTERACT(Category.PLAYER, PlayerInteractEvent.class),
/** /**
* Called when a player right clicks an entity * Called when a player right clicks an entity
* *
* @see org.bukkit.event.player.PlayerInteractEntityEvent * @see org.bukkit.event.player.PlayerInteractEntityEvent
*/ */
PLAYER_INTERACT_ENTITY(Category.PLAYER), PLAYER_INTERACT_ENTITY(Category.PLAYER, PlayerInteractEntityEvent.class),
/** /**
* Called when a player throws an egg * Called when a player throws an egg
* *
* @see org.bukkit.event.player.PlayerEggThrowEvent * @see org.bukkit.event.player.PlayerEggThrowEvent
*/ */
PLAYER_EGG_THROW(Category.PLAYER), PLAYER_EGG_THROW(Category.PLAYER, PlayerEggThrowEvent.class),
/** /**
* Called when a player teleports from one position to another * Called when a player teleports from one position to another
* *
* @see org.bukkit.event.player.PlayerTeleportEvent * @see org.bukkit.event.player.PlayerTeleportEvent
*/ */
PLAYER_TELEPORT(Category.PLAYER), PLAYER_TELEPORT(Category.PLAYER, PlayerTeleportEvent.class),
/** /**
* Called when a player completes the portaling process by standing in a portal * Called when a player completes the portaling process by standing in a portal
* *
* @see org.bukkit.event.player.PlayerPortalEvent * @see org.bukkit.event.player.PlayerPortalEvent
*/ */
PLAYER_PORTAL(Category.PLAYER), PLAYER_PORTAL(Category.PLAYER, PlayerPortalEvent.class),
/** /**
* Called when a player changes their held item * Called when a player changes their held item
* *
* @see org.bukkit.event.player.PlayerItemHeldEvent * @see org.bukkit.event.player.PlayerItemHeldEvent
*/ */
PLAYER_ITEM_HELD(Category.PLAYER), PLAYER_ITEM_HELD(Category.PLAYER, PlayerItemHeldEvent.class),
/** /**
* Called when a player drops an item * Called when a player drops an item
* *
* @see org.bukkit.event.player.PlayerDropItemEvent * @see org.bukkit.event.player.PlayerDropItemEvent
*/ */
PLAYER_DROP_ITEM(Category.PLAYER), PLAYER_DROP_ITEM(Category.PLAYER, PlayerDropItemEvent.class),
/** /**
* Called when a player picks an item up off the ground * Called when a player picks an item up off the ground
* *
* @see org.bukkit.event.player.PlayerPickupItemEvent * @see org.bukkit.event.player.PlayerPickupItemEvent
*/ */
PLAYER_PICKUP_ITEM(Category.PLAYER), PLAYER_PICKUP_ITEM(Category.PLAYER, PlayerPickupItemEvent.class),
/** /**
* Called when a player empties a bucket * Called when a player empties a bucket
* *
* @see org.bukkit.event.player.PlayerBucketEmptyEvent * @see org.bukkit.event.player.PlayerBucketEmptyEvent
*/ */
PLAYER_BUCKET_EMPTY(Category.PLAYER), PLAYER_BUCKET_EMPTY(Category.PLAYER, PlayerBucketEmptyEvent.class),
/** /**
* Called when a player fills a bucket * Called when a player fills a bucket
* *
* @see org.bukkit.event.player.PlayerBucketFillEvent * @see org.bukkit.event.player.PlayerBucketFillEvent
*/ */
PLAYER_BUCKET_FILL(Category.PLAYER), PLAYER_BUCKET_FILL(Category.PLAYER, PlayerBucketFillEvent.class),
/** /**
* Called when a player interacts with the inventory * Called when a player interacts with the inventory
* *
* @see org.bukkit.event.player.PlayerInventoryEvent * @see org.bukkit.event.player.PlayerInventoryEvent
*/ */
PLAYER_INVENTORY(Category.PLAYER), PLAYER_INVENTORY(Category.PLAYER, PlayerInventoryEvent.class),
/** /**
* Called when a player enter a bed * Called when a player enter a bed
* *
* @see org.bukkit.event.player.PlayerBedEnterEvent * @see org.bukkit.event.player.PlayerBedEnterEvent
*/ */
PLAYER_BED_ENTER(Category.PLAYER), PLAYER_BED_ENTER(Category.PLAYER, PlayerBedEnterEvent.class),
/** /**
* Called when a player leaves a bed * Called when a player leaves a bed
* *
* @see org.bukkit.event.player.PlayerBedLeaveEvent * @see org.bukkit.event.player.PlayerBedLeaveEvent
*/ */
PLAYER_BED_LEAVE(Category.PLAYER), PLAYER_BED_LEAVE(Category.PLAYER, PlayerBedLeaveEvent.class),
/** /**
* Called when a player is fishing * Called when a player is fishing
* *
* @see org.bukkit.event.player.PlayerFishEvent * @see org.bukkit.event.player.PlayerFishEvent
*/ */
PLAYER_FISH(Category.PLAYER), PLAYER_FISH(Category.PLAYER, PlayerFishEvent.class),
/** /**
* Called when the game mode of a player is changed * Called when the game mode of a player is changed
* *
* @see org.bukkit.event.player.PlayerGameModeChangeEvent * @see org.bukkit.event.player.PlayerGameModeChangeEvent
*/ */
PLAYER_GAME_MODE_CHANGE(Category.PLAYER), PLAYER_GAME_MODE_CHANGE(Category.PLAYER, PlayerGameModeChangeEvent.class),
/** /**
* Called after a player has changed to a new world * Called after a player has changed to a new world
* *
* @see org.bukkit.event.player.PlayerChangedWorldEvent * @see org.bukkit.event.player.PlayerChangedWorldEvent
*/ */
PLAYER_CHANGED_WORLD(Category.PLAYER), PLAYER_CHANGED_WORLD(Category.PLAYER, PlayerChangedWorldEvent.class),
/** /**
* BLOCK EVENTS * BLOCK EVENTS
@ -329,7 +373,7 @@ public abstract class Event implements Serializable {
* *
* @see org.bukkit.event.block.BlockDamageEvent * @see org.bukkit.event.block.BlockDamageEvent
*/ */
BLOCK_DAMAGE(Category.BLOCK), BLOCK_DAMAGE(Category.BLOCK, BlockDamageEvent.class),
/** /**
* Called when a block is undergoing a universe physics * Called when a block is undergoing a universe physics
* check on whether it can be built * check on whether it can be built
@ -338,21 +382,21 @@ public abstract class Event implements Serializable {
* *
* @see org.bukkit.event.block.BlockCanBuildEvent * @see org.bukkit.event.block.BlockCanBuildEvent
*/ */
BLOCK_CANBUILD(Category.BLOCK), BLOCK_CANBUILD(Category.BLOCK, BlockCanBuildEvent.class),
/** /**
* Called when a block of water or lava attempts to flow into another * Called when a block of water or lava attempts to flow into another
* block * block
* *
* @see org.bukkit.event.block.BlockFromToEvent * @see org.bukkit.event.block.BlockFromToEvent
*/ */
BLOCK_FROMTO(Category.BLOCK), BLOCK_FROMTO(Category.BLOCK, BlockFromToEvent.class),
/** /**
* Called when a block is being set on fire from another block, such as * Called when a block is being set on fire from another block, such as
* an adjacent block of fire attempting to set fire to wood * an adjacent block of fire attempting to set fire to wood
* *
* @see org.bukkit.event.block.BlockIgniteEvent * @see org.bukkit.event.block.BlockIgniteEvent
*/ */
BLOCK_IGNITE(Category.BLOCK), BLOCK_IGNITE(Category.BLOCK, BlockIgniteEvent.class),
/** /**
* Called when a block undergoes a physics check * Called when a block undergoes a physics check
* <p /> * <p />
@ -361,37 +405,37 @@ public abstract class Event implements Serializable {
* *
* @see org.bukkit.event.block.BlockPhysicsEvent * @see org.bukkit.event.block.BlockPhysicsEvent
*/ */
BLOCK_PHYSICS(Category.BLOCK), BLOCK_PHYSICS(Category.BLOCK, BlockPhysicsEvent.class),
/** /**
* Called when a player is attempting to place a block * Called when a player is attempting to place a block
* *
* @see org.bukkit.event.block.BlockPlaceEvent * @see org.bukkit.event.block.BlockPlaceEvent
*/ */
BLOCK_PLACE(Category.BLOCK), BLOCK_PLACE(Category.BLOCK, BlockPlaceEvent.class),
/** /**
* Called when a block dispenses something * Called when a block dispenses something
* *
* @see org.bukkit.event.block.BlockDispenseEvent * @see org.bukkit.event.block.BlockDispenseEvent
*/ */
BLOCK_DISPENSE(Category.BLOCK), BLOCK_DISPENSE(Category.BLOCK, BlockDispenseEvent.class),
/** /**
* Called when a block is destroyed from being burnt by fire * Called when a block is destroyed from being burnt by fire
* *
* @see org.bukkit.event.block.BlockBurnEvent * @see org.bukkit.event.block.BlockBurnEvent
*/ */
BLOCK_BURN(Category.BLOCK), BLOCK_BURN(Category.BLOCK, BlockBurnEvent.class),
/** /**
* Called when leaves are decaying naturally * Called when leaves are decaying naturally
* *
* @see org.bukkit.event.block.LeavesDecayEvent * @see org.bukkit.event.block.LeavesDecayEvent
*/ */
LEAVES_DECAY(Category.BLOCK), LEAVES_DECAY(Category.BLOCK, LeavesDecayEvent.class),
/** /**
* Called when a sign is changed * Called when a sign is changed
* *
* @see org.bukkit.event.block.SignChangeEvent * @see org.bukkit.event.block.SignChangeEvent
*/ */
SIGN_CHANGE(Category.BLOCK), SIGN_CHANGE(Category.BLOCK, SignChangeEvent.class),
/** /**
* Called when a block changes redstone current. Only triggered on blocks * Called when a block changes redstone current. Only triggered on blocks
* that are actually capable of transmitting or carrying a redstone * that are actually capable of transmitting or carrying a redstone
@ -399,44 +443,43 @@ public abstract class Event implements Serializable {
* *
* @see org.bukkit.event.block.BlockRedstoneEvent * @see org.bukkit.event.block.BlockRedstoneEvent
*/ */
REDSTONE_CHANGE(Category.BLOCK), REDSTONE_CHANGE(Category.BLOCK, BlockRedstoneEvent.class),
/** /**
* Called when a block is broken by a player * Called when a block is broken by a player
* *
* @see org.bukkit.event.block.BlockBreakEvent * @see org.bukkit.event.block.BlockBreakEvent
*/ */
BLOCK_BREAK(Category.BLOCK), BLOCK_BREAK(Category.BLOCK, BlockBreakEvent.class),
/** /**
* Called when a block is formed based on world conditions * Called when a block is formed based on world conditions
* *
* @see org.bukkit.event.block.BlockFormEvent * @see org.bukkit.event.block.BlockFormEvent
*/ */
BLOCK_FORM(Category.BLOCK), BLOCK_FORM(Category.BLOCK, BlockFormEvent.class),
/** /**
* Called when a block spreads based on world conditions * Called when a block spreads based on world conditions
* *
* @see org.bukkit.event.block.BlockSpreadEvent * @see org.bukkit.event.block.BlockSpreadEvent
*/ */
BLOCK_SPREAD(Category.BLOCK), BLOCK_SPREAD(Category.BLOCK, BlockSpreadEvent.class),
/** /**
* Called when a block fades, melts or disappears based on world conditions * Called when a block fades, melts or disappears based on world conditions
* *
* @see org.bukkit.event.block.BlockFadeEvent * @see org.bukkit.event.block.BlockFadeEvent
*/ */
BLOCK_FADE(Category.BLOCK), BLOCK_FADE(Category.BLOCK, BlockFadeEvent.class),
/** /**
* Called when a piston extends * Called when a piston extends
* *
* @see org.bukkit.event.block.BlockPistonExtendEvent * @see org.bukkit.event.block.BlockPistonExtendEvent
*/ */
BLOCK_PISTON_EXTEND(Category.BLOCK), BLOCK_PISTON_EXTEND(Category.BLOCK, BlockPistonExtendEvent.class),
/** /**
* Called when a piston retracts * Called when a piston retracts
* *
* @see org.bukkit.event.block.BlockPistonRetractEvent * @see org.bukkit.event.block.BlockPistonRetractEvent
*/ */
BLOCK_PISTON_RETRACT(Category.BLOCK), BLOCK_PISTON_RETRACT(Category.BLOCK, BlockPistonRetractEvent.class),
/** /**
* INVENTORY EVENTS * INVENTORY EVENTS
*/ */
@ -446,44 +489,43 @@ public abstract class Event implements Serializable {
* *
* @todo: add javadoc see comment * @todo: add javadoc see comment
*/ */
INVENTORY_OPEN(Category.INVENTORY), INVENTORY_OPEN(Category.INVENTORY, null),
/** /**
* Called when a player closes an inventory * Called when a player closes an inventory
* *
* @todo: add javadoc see comment * @todo: add javadoc see comment
*/ */
INVENTORY_CLOSE(Category.INVENTORY), INVENTORY_CLOSE(Category.INVENTORY, null),
/** /**
* Called when a player clicks on an inventory slot * Called when a player clicks on an inventory slot
* *
* @todo: add javadoc see comment * @todo: add javadoc see comment
*/ */
INVENTORY_CLICK(Category.INVENTORY), INVENTORY_CLICK(Category.INVENTORY, null),
/** /**
* Called when an inventory slot changes values or type * Called when an inventory slot changes values or type
* *
* @todo: add javadoc see comment * @todo: add javadoc see comment
*/ */
INVENTORY_CHANGE(Category.INVENTORY), INVENTORY_CHANGE(Category.INVENTORY, null),
/** /**
* Called when a player is attempting to perform an inventory transaction * Called when a player is attempting to perform an inventory transaction
* *
* @todo: add javadoc see comment * @todo: add javadoc see comment
*/ */
INVENTORY_TRANSACTION(Category.INVENTORY), INVENTORY_TRANSACTION(Category.INVENTORY, null),
/** /**
* Called when an ItemStack is successfully smelted in a furnace. * Called when an ItemStack is successfully smelted in a furnace.
* *
* @see org.bukkit.event.inventory.FurnaceSmeltEvent * @see org.bukkit.event.inventory.FurnaceSmeltEvent
*/ */
FURNACE_SMELT(Category.INVENTORY), FURNACE_SMELT(Category.INVENTORY, FurnaceSmeltEvent.class),
/** /**
* Called when an ItemStack is successfully burned as fuel in a furnace. * Called when an ItemStack is successfully burned as fuel in a furnace.
* *
* @see org.bukkit.event.inventory.FurnaceBurnEvent * @see org.bukkit.event.inventory.FurnaceBurnEvent
*/ */
FURNACE_BURN(Category.INVENTORY), FURNACE_BURN(Category.INVENTORY, FurnaceBurnEvent.class),
/** /**
* SERVER EVENTS * SERVER EVENTS
*/ */
@ -493,37 +535,37 @@ public abstract class Event implements Serializable {
* *
* @see org.bukkit.event.server.PluginEnableEvent * @see org.bukkit.event.server.PluginEnableEvent
*/ */
PLUGIN_ENABLE(Category.SERVER), PLUGIN_ENABLE(Category.SERVER, PluginEnableEvent.class),
/** /**
* Called when a plugin is disabled * Called when a plugin is disabled
* *
* @see org.bukkit.event.server.PluginDisableEvent * @see org.bukkit.event.server.PluginDisableEvent
*/ */
PLUGIN_DISABLE(Category.SERVER), PLUGIN_DISABLE(Category.SERVER, PluginDisableEvent.class),
/** /**
* Called when a server command is called * Called when a server command is called
* *
* @see org.bukkit.event.server.ServerCommandEvent * @see org.bukkit.event.server.ServerCommandEvent
*/ */
SERVER_COMMAND(Category.SERVER), SERVER_COMMAND(Category.SERVER, ServerCommandEvent.class),
/** /**
* Called when a remote server command is called * Called when a remote server command is called
* *
* @see org.bukkit.event.server.ServerCommandEvent * @see org.bukkit.event.server.ServerCommandEvent
*/ */
REMOTE_COMMAND(Category.SERVER), REMOTE_COMMAND(Category.SERVER, ServerCommandEvent.class),
/** /**
* Called when a map is initialized (created or loaded into memory) * Called when a map is initialized (created or loaded into memory)
* *
* @see org.bukkit.event.server.MapInitializeEvent * @see org.bukkit.event.server.MapInitializeEvent
*/ */
MAP_INITIALIZE(Category.SERVER), MAP_INITIALIZE(Category.SERVER, MapInitializeEvent.class),
/** /**
* Called when a client pings a server. * Called when a client pings a server.
* *
* @see org.bukkit.event.server.ServerListPingEvent * @see org.bukkit.event.server.ServerListPingEvent
*/ */
SERVER_LIST_PING(Category.SERVER), SERVER_LIST_PING(Category.SERVER, ServerListPingEvent.class),
/** /**
* WORLD EVENTS * WORLD EVENTS
@ -537,13 +579,13 @@ public abstract class Event implements Serializable {
* *
* @see org.bukkit.event.world.ChunkLoadEvent * @see org.bukkit.event.world.ChunkLoadEvent
*/ */
CHUNK_LOAD(Category.WORLD), CHUNK_LOAD(Category.WORLD, ChunkLoadEvent.class),
/** /**
* Called when a chunk is unloaded * Called when a chunk is unloaded
* *
* @see org.bukkit.event.world.ChunkUnloadEvent * @see org.bukkit.event.world.ChunkUnloadEvent
*/ */
CHUNK_UNLOAD(Category.WORLD), CHUNK_UNLOAD(Category.WORLD, ChunkUnloadEvent.class),
/** /**
* Called when a newly created chunk has been populated. * Called when a newly created chunk has been populated.
* <p /> * <p />
@ -551,61 +593,61 @@ public abstract class Event implements Serializable {
* *
* @see org.bukkit.event.world.ChunkPopulateEvent * @see org.bukkit.event.world.ChunkPopulateEvent
*/ */
CHUNK_POPULATED(Category.WORLD), CHUNK_POPULATED(Category.WORLD, ChunkPopulateEvent.class),
/** /**
* Called when an ItemEntity spawns in the world * Called when an ItemEntity spawns in the world
* *
* @see org.bukkit.event.entity.ItemSpawnEvent * @see org.bukkit.event.entity.ItemSpawnEvent
*/ */
ITEM_SPAWN(Category.WORLD), ITEM_SPAWN(Category.WORLD, ItemSpawnEvent.class),
/** /**
* Called when a World's spawn is changed * Called when a World's spawn is changed
* *
* @see org.bukkit.event.world.SpawnChangeEvent * @see org.bukkit.event.world.SpawnChangeEvent
*/ */
SPAWN_CHANGE(Category.WORLD), SPAWN_CHANGE(Category.WORLD, SpawnChangeEvent.class),
/** /**
* Called when a world is saved * Called when a world is saved
* *
* @see org.bukkit.event.world.WorldSaveEvent * @see org.bukkit.event.world.WorldSaveEvent
*/ */
WORLD_SAVE(Category.WORLD), WORLD_SAVE(Category.WORLD, WorldSaveEvent.class),
/** /**
* Called when a World is initializing * Called when a World is initializing
* *
* @see org.bukkit.event.world.WorldInitEvent * @see org.bukkit.event.world.WorldInitEvent
*/ */
WORLD_INIT(Category.WORLD), WORLD_INIT(Category.WORLD, WorldInitEvent.class),
/** /**
* Called when a World is loaded * Called when a World is loaded
* *
* @see org.bukkit.event.world.WorldLoadEvent * @see org.bukkit.event.world.WorldLoadEvent
*/ */
WORLD_LOAD(Category.WORLD), WORLD_LOAD(Category.WORLD, WorldLoadEvent.class),
/** /**
* Called when a World is unloaded * Called when a World is unloaded
* *
* @see org.bukkit.event.world.WorldUnloadEvent * @see org.bukkit.event.world.WorldUnloadEvent
*/ */
WORLD_UNLOAD(Category.WORLD), WORLD_UNLOAD(Category.WORLD, WorldUnloadEvent.class),
/** /**
* Called when world attempts to create a matching end to a portal * Called when world attempts to create a matching end to a portal
* *
* @see org.bukkit.event.world.PortalCreateEvent * @see org.bukkit.event.world.PortalCreateEvent
*/ */
PORTAL_CREATE(Category.WORLD), PORTAL_CREATE(Category.WORLD, PortalCreateEvent.class),
/** /**
* Called when an organic structure attempts to grow (Sapling -> Tree), (Mushroom -> Huge Mushroom), naturally or using bonemeal. * Called when an organic structure attempts to grow (Sapling -> Tree), (Mushroom -> Huge Mushroom), naturally or using bonemeal.
* *
* @see org.bukkit.event.world.StructureGrowEvent * @see org.bukkit.event.world.StructureGrowEvent
*/ */
STRUCTURE_GROW(Category.WORLD), STRUCTURE_GROW(Category.WORLD, StructureGrowEvent.class),
/** /**
* Called when an item despawns from a world * Called when an item despawns from a world
* *
* @see org.bukkit.event.entity.ItemDespawnEvent * @see org.bukkit.event.entity.ItemDespawnEvent
*/ */
ITEM_DESPAWN(Category.WORLD), ITEM_DESPAWN(Category.WORLD, ItemDespawnEvent.class),
/** /**
* ENTITY EVENTS * ENTITY EVENTS
@ -616,19 +658,19 @@ public abstract class Event implements Serializable {
* *
* @see org.bukkit.event.painting.PaintingPlaceEvent * @see org.bukkit.event.painting.PaintingPlaceEvent
*/ */
PAINTING_PLACE(Category.ENTITY), PAINTING_PLACE(Category.ENTITY, PaintingPlaceEvent.class),
/** /**
* Called when a painting is removed * Called when a painting is removed
* *
* @see org.bukkit.event.painting.PaintingBreakEvent * @see org.bukkit.event.painting.PaintingBreakEvent
*/ */
PAINTING_BREAK(Category.ENTITY), PAINTING_BREAK(Category.ENTITY, PaintingBreakEvent.class),
/** /**
* Called when an entity touches a portal block * Called when an entity touches a portal block
* *
* @see org.bukkit.event.entity.EntityPortalEnterEvent * @see org.bukkit.event.entity.EntityPortalEnterEvent
*/ */
ENTITY_PORTAL_ENTER(Category.ENTITY), ENTITY_PORTAL_ENTER(Category.ENTITY, EntityPortalEnterEvent.class),
/** /**
* LIVING_ENTITY EVENTS * LIVING_ENTITY EVENTS
@ -640,31 +682,31 @@ public abstract class Event implements Serializable {
* *
* @see org.bukkit.event.entity.CreatureSpawnEvent * @see org.bukkit.event.entity.CreatureSpawnEvent
*/ */
CREATURE_SPAWN(Category.LIVING_ENTITY), CREATURE_SPAWN(Category.LIVING_ENTITY, CreatureSpawnEvent.class),
/** /**
* Called when a LivingEntity is damaged with no source. * Called when a LivingEntity is damaged with no source.
* *
* @see org.bukkit.event.entity.EntityDamageEvent * @see org.bukkit.event.entity.EntityDamageEvent
*/ */
ENTITY_DAMAGE(Category.LIVING_ENTITY), ENTITY_DAMAGE(Category.LIVING_ENTITY, EntityDamageEvent.class),
/** /**
* Called when a LivingEntity dies * Called when a LivingEntity dies
* *
* @see org.bukkit.event.entity.EntityDeathEvent * @see org.bukkit.event.entity.EntityDeathEvent
*/ */
ENTITY_DEATH(Category.LIVING_ENTITY), ENTITY_DEATH(Category.LIVING_ENTITY, EntityDeathEvent.class),
/** /**
* Called when a Skeleton or Zombie catch fire due to the sun * Called when a Skeleton or Zombie catch fire due to the sun
* *
* @see org.bukkit.event.entity.EntityCombustEvent * @see org.bukkit.event.entity.EntityCombustEvent
*/ */
ENTITY_COMBUST(Category.LIVING_ENTITY), ENTITY_COMBUST(Category.LIVING_ENTITY, EntityCombustEvent.class),
/** /**
* Called when an entity explodes, either TNT, Creeper, or Ghast Fireball * Called when an entity explodes, either TNT, Creeper, or Ghast Fireball
* *
* @see org.bukkit.event.entity.EntityExplodeEvent * @see org.bukkit.event.entity.EntityExplodeEvent
*/ */
ENTITY_EXPLODE(Category.LIVING_ENTITY), ENTITY_EXPLODE(Category.LIVING_ENTITY, EntityExplodeEvent.class),
/** /**
* Called when an entity has made a decision to explode. * Called when an entity has made a decision to explode.
* <p /> * <p />
@ -677,80 +719,80 @@ public abstract class Event implements Serializable {
* *
* @see org.bukkit.event.entity.ExplosionPrimeEvent * @see org.bukkit.event.entity.ExplosionPrimeEvent
*/ */
EXPLOSION_PRIME(Category.LIVING_ENTITY), EXPLOSION_PRIME(Category.LIVING_ENTITY, ExplosionPrimeEvent.class),
/** /**
* Called when an entity targets another entity * Called when an entity targets another entity
* *
* @see org.bukkit.event.entity.EntityTargetEvent * @see org.bukkit.event.entity.EntityTargetEvent
*/ */
ENTITY_TARGET(Category.LIVING_ENTITY), ENTITY_TARGET(Category.LIVING_ENTITY, EntityTargetEvent.class),
/** /**
* Called when an entity interacts with a block * Called when an entity interacts with a block
* This event specifically excludes player entities * This event specifically excludes player entities
* *
* @see org.bukkit.event.entity.EntityInteractEvent * @see org.bukkit.event.entity.EntityInteractEvent
*/ */
ENTITY_INTERACT(Category.LIVING_ENTITY), ENTITY_INTERACT(Category.LIVING_ENTITY, EntityInteractEvent.class),
/** /**
* Called when a creeper gains or loses a power shell * Called when a creeper gains or loses a power shell
* *
* @see org.bukkit.event.entity.CreeperPowerEvent * @see org.bukkit.event.entity.CreeperPowerEvent
*/ */
CREEPER_POWER(Category.LIVING_ENTITY), CREEPER_POWER(Category.LIVING_ENTITY, CreeperPowerEvent.class),
/** /**
* Called when a pig is zapped, zombifying it * Called when a pig is zapped, zombifying it
* *
* @see org.bukkit.event.entity.PigZapEvent * @see org.bukkit.event.entity.PigZapEvent
*/ */
PIG_ZAP(Category.LIVING_ENTITY), PIG_ZAP(Category.LIVING_ENTITY, PigZapEvent.class),
/** /**
* Called when a LivingEntity is tamed * Called when a LivingEntity is tamed
* *
* @see org.bukkit.event.entity.EntityTameEvent * @see org.bukkit.event.entity.EntityTameEvent
*/ */
ENTITY_TAME(Category.LIVING_ENTITY), ENTITY_TAME(Category.LIVING_ENTITY, EntityTameEvent.class),
/** /**
* Called when a {@link Projectile} hits something * Called when a {@link Projectile} hits something
* *
* @see org.bukkit.event.entity.ProjectileHitEvent * @see org.bukkit.event.entity.ProjectileHitEvent
*/ */
PROJECTILE_HIT(Category.ENTITY), PROJECTILE_HIT(Category.ENTITY, ProjectileHitEvent.class),
/** /**
* Called when a Slime splits into smaller Slimes upon death * Called when a Slime splits into smaller Slimes upon death
* *
* @see org.bukkit.event.entity.SlimeSplitEvent * @see org.bukkit.event.entity.SlimeSplitEvent
*/ */
SLIME_SPLIT(Category.LIVING_ENTITY), SLIME_SPLIT(Category.LIVING_ENTITY, SlimeSplitEvent.class),
/** /**
* Called when a LivingEntity is regains health * Called when a LivingEntity is regains health
* *
* @see org.bukkit.event.entity.EntityRegainHealthEvent * @see org.bukkit.event.entity.EntityRegainHealthEvent
*/ */
ENTITY_REGAIN_HEALTH(Category.LIVING_ENTITY), ENTITY_REGAIN_HEALTH(Category.LIVING_ENTITY, EntityRegainHealthEvent.class),
/** /**
* Called when an Enderman picks a block up * Called when an Enderman picks a block up
* *
* @see org.bukkit.event.entity.EndermanPickupEvent * @see org.bukkit.event.entity.EndermanPickupEvent
*/ */
ENDERMAN_PICKUP(Category.LIVING_ENTITY), ENDERMAN_PICKUP(Category.LIVING_ENTITY, EndermanPickupEvent.class),
/** /**
* Called when an Enderman places a block * Called when an Enderman places a block
* *
* @see org.bukkit.event.entity.EndermanPlaceEvent * @see org.bukkit.event.entity.EndermanPlaceEvent
*/ */
ENDERMAN_PLACE(Category.LIVING_ENTITY), ENDERMAN_PLACE(Category.LIVING_ENTITY, EndermanPlaceEvent.class),
/** /**
* Called when a human entity's food level changes * Called when a human entity's food level changes
* *
* @see org.bukkit.event.entity.FoodLevelChangeEvent * @see org.bukkit.event.entity.FoodLevelChangeEvent
*/ */
FOOD_LEVEL_CHANGE(Category.LIVING_ENTITY), FOOD_LEVEL_CHANGE(Category.LIVING_ENTITY, FoodLevelChangeEvent.class),
/** /**
* Called when an entity creates a portal in a world * Called when an entity creates a portal in a world
* *
* @see org.bukkit.event.entity.EntityCreatePortalEvent * @see org.bukkit.event.entity.EntityCreatePortalEvent
*/ */
ENTITY_CREATE_PORTAL(Category.LIVING_ENTITY), ENTITY_CREATE_PORTAL(Category.LIVING_ENTITY, EntityCreatePortalEvent.class),
/** /**
* WEATHER EVENTS * WEATHER EVENTS
@ -761,19 +803,19 @@ public abstract class Event implements Serializable {
* *
* @see org.bukkit.event.weather.LightningStrikeEvent * @see org.bukkit.event.weather.LightningStrikeEvent
*/ */
LIGHTNING_STRIKE(Category.WEATHER), LIGHTNING_STRIKE(Category.WEATHER, LightningStrikeEvent.class),
/** /**
* Called when the weather in a world changes * Called when the weather in a world changes
* *
* @see org.bukkit.event.weather.WeatherChangeEvent * @see org.bukkit.event.weather.WeatherChangeEvent
*/ */
WEATHER_CHANGE(Category.WEATHER), WEATHER_CHANGE(Category.WEATHER, WeatherChangeEvent.class),
/** /**
* Called when the thunder state in a world changes * Called when the thunder state in a world changes
* *
* @see org.bukkit.event.weather.ThunderChangeEvent * @see org.bukkit.event.weather.ThunderChangeEvent
*/ */
THUNDER_CHANGE(Category.WEATHER), THUNDER_CHANGE(Category.WEATHER, ThunderChangeEvent.class),
/** /**
* VEHICLE EVENTS * VEHICLE EVENTS
@ -784,55 +826,55 @@ public abstract class Event implements Serializable {
* *
* @see org.bukkit.event.vehicle.VehicleCreateEvent * @see org.bukkit.event.vehicle.VehicleCreateEvent
*/ */
VEHICLE_CREATE(Category.VEHICLE), VEHICLE_CREATE(Category.VEHICLE, VehicleCreateEvent.class),
/** /**
* Called when a vehicle is destroyed * Called when a vehicle is destroyed
* *
* @see org.bukkit.event.vehicle.VehicleDestroyEvent * @see org.bukkit.event.vehicle.VehicleDestroyEvent
*/ */
VEHICLE_DESTROY(Category.VEHICLE), VEHICLE_DESTROY(Category.VEHICLE, VehicleDestroyEvent.class),
/** /**
* Called when a vehicle is damaged by a LivingEntity * Called when a vehicle is damaged by a LivingEntity
* *
* @see org.bukkit.event.vehicle.VehicleDamageEvent * @see org.bukkit.event.vehicle.VehicleDamageEvent
*/ */
VEHICLE_DAMAGE(Category.VEHICLE), VEHICLE_DAMAGE(Category.VEHICLE, VehicleDamageEvent.class),
/** /**
* Called when a vehicle collides with an Entity * Called when a vehicle collides with an Entity
* *
* @see org.bukkit.event.vehicle.VehicleCollisionEvent * @see org.bukkit.event.vehicle.VehicleCollisionEvent
*/ */
VEHICLE_COLLISION_ENTITY(Category.VEHICLE), VEHICLE_COLLISION_ENTITY(Category.VEHICLE, VehicleEntityCollisionEvent.class),
/** /**
* Called when a vehicle collides with a Block * Called when a vehicle collides with a Block
* *
* @see org.bukkit.event.vehicle.VehicleBlockCollisionEvent * @see org.bukkit.event.vehicle.VehicleBlockCollisionEvent
*/ */
VEHICLE_COLLISION_BLOCK(Category.VEHICLE), VEHICLE_COLLISION_BLOCK(Category.VEHICLE, VehicleBlockCollisionEvent.class),
/** /**
* Called when a vehicle is entered by a LivingEntity * Called when a vehicle is entered by a LivingEntity
* *
* @see org.bukkit.event.vehicle.VehicleEnterEvent * @see org.bukkit.event.vehicle.VehicleEnterEvent
*/ */
VEHICLE_ENTER(Category.VEHICLE), VEHICLE_ENTER(Category.VEHICLE, VehicleEnterEvent.class),
/** /**
* Called when a vehicle is exited by a LivingEntity * Called when a vehicle is exited by a LivingEntity
* *
* @see org.bukkit.event.vehicle.VehicleExitEvent * @see org.bukkit.event.vehicle.VehicleExitEvent
*/ */
VEHICLE_EXIT(Category.VEHICLE), VEHICLE_EXIT(Category.VEHICLE, VehicleExitEvent.class),
/** /**
* Called when a vehicle moves position in the world * Called when a vehicle moves position in the world
* *
* @see org.bukkit.event.vehicle.VehicleMoveEvent * @see org.bukkit.event.vehicle.VehicleMoveEvent
*/ */
VEHICLE_MOVE(Category.VEHICLE), VEHICLE_MOVE(Category.VEHICLE, VehicleMoveEvent.class),
/** /**
* Called when a vehicle is going through an update cycle, rechecking itself * Called when a vehicle is going through an update cycle, rechecking itself
* *
* @see org.bukkit.event.vehicle.VehicleUpdateEvent * @see org.bukkit.event.vehicle.VehicleUpdateEvent
*/ */
VEHICLE_UPDATE(Category.VEHICLE), VEHICLE_UPDATE(Category.VEHICLE, VehicleUpdateEvent.class),
/** /**
* MISCELLANEOUS EVENTS * MISCELLANEOUS EVENTS
*/ */
@ -840,12 +882,18 @@ public abstract class Event implements Serializable {
/** /**
* Represents a custom event, isn't actually used * Represents a custom event, isn't actually used
*/ */
CUSTOM_EVENT(Category.MISCELLANEOUS); CUSTOM_EVENT(Category.MISCELLANEOUS, TransitionalCustomEvent.class),
/**
* Represents an event using the new, Event.Type-less event system to avoid NPE-ing
*/
FIXED_EVENT(Category.MISCELLANEOUS, Event.class);
private final Category category; private final Category category;
private final Class<? extends Event> clazz;
private Type(Category category) { private Type(Category category, Class<? extends Event> clazz) {
this.category = category; this.category = category;
this.clazz = clazz;
} }
/** /**
@ -856,6 +904,10 @@ public abstract class Event implements Serializable {
public Category getCategory() { public Category getCategory() {
return category; return category;
} }
public Class<? extends Event> getEventClass() {
return clazz;
}
} }
public enum Result { public enum Result {

Datei anzeigen

@ -1,6 +1,7 @@
package org.bukkit.event; package org.bukkit.event;
public class EventException extends Exception { public class EventException extends Exception {
private static final HandlerList handlers = new HandlerList();
private static final long serialVersionUID = 3532808232324183999L; private static final long serialVersionUID = 3532808232324183999L;
private final Throwable cause; private final Throwable cause;

Datei anzeigen

@ -0,0 +1,15 @@
package org.bukkit.event;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* An annotation to mark methods as being event handler methods
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface EventHandler {
Class<? extends Event> event();
EventPriority priority();
}

Datei anzeigen

@ -0,0 +1,45 @@
package org.bukkit.event;
/**
* Represents an event's priority in execution
*/
public enum EventPriority {
/**
* Event call is of very low importance and should be ran first, to allow
* other plugins to further customise the outcome
*/
LOWEST(0),
/**
* Event call is of low importance
*/
LOW(1),
/**
* Event call is neither important or unimportant, and may be ran normally
*/
NORMAL(2),
/**
* Event call is of high importance
*/
HIGH(3),
/**
* Event call is critical and must have the final say in what happens
* to the event
*/
HIGHEST(4),
/**
* Event is listened to purely for monitoring the outcome of an event.
* <p/>
* No modifications to the event should be made under this priority
*/
MONITOR(5);
private final int slot;
private EventPriority(int slot) {
this.slot = slot;
}
public int getSlot() {
return slot;
}
}

Datei anzeigen

@ -0,0 +1,133 @@
package org.bukkit.event;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredListener;
import java.util.*;
import java.util.Map.Entry;
/**
* A list of event handlers, stored per-event. Based on lahwran's fevents.
*/
@SuppressWarnings("unchecked")
public class HandlerList {
/**
* Handler array. This field being an array is the key to this system's speed.
*/
private RegisteredListener[][] handlers = new RegisteredListener[EventPriority.values().length][];
/**
* Dynamic handler lists. These are changed using register() and
* unregister() and are automatically baked to the handlers array any
* time they have changed.
*/
private final EnumMap<EventPriority, ArrayList<RegisteredListener>> handlerslots;
/**
* Whether the current HandlerList has been fully baked. When this is set
* to false, the Map<EventPriority, List<RegisteredListener>> will be baked to RegisteredListener[][]
* next time the event is called.
*
* @see org.bukkit.plugin.SimplePluginManager#callEvent
*/
private boolean baked = false;
/**
* List of all HandlerLists which have been created, for use in bakeAll()
*/
private static ArrayList<HandlerList> alllists = new ArrayList<HandlerList>();
/**
* Bake all handler lists. Best used just after all normal event
* registration is complete, ie just after all plugins are loaded if
* you're using fevents in a plugin system.
*/
public static void bakeAll() {
for (HandlerList h : alllists) {
h.bake();
}
}
public static void unregisterAll() {
for (HandlerList h : alllists) {
h.handlerslots.clear();
h.baked = false;
}
}
public static void unregisterAll(Plugin plugin) {
for (HandlerList h : alllists) {
h.unregister(plugin);
}
}
/**
* Create a new handler list and initialize using EventPriority
* The HandlerList is then added to meta-list for use in bakeAll()
*/
public HandlerList() {
handlerslots = new EnumMap<EventPriority, ArrayList<RegisteredListener>>(EventPriority.class);
for (EventPriority o : EventPriority.values()) {
handlerslots.put(o, new ArrayList<RegisteredListener>());
}
alllists.add(this);
}
/**
* Register a new listener in this handler list
*
* @param listener listener to register
*/
public void register(RegisteredListener listener) {
if (handlerslots.get(listener.getPriority()).contains(listener))
throw new IllegalStateException("This listener is already registered to priority " + listener.getPriority().toString());
baked = false;
handlerslots.get(listener.getPriority()).add(listener);
}
public void registerAll(Collection<RegisteredListener> listeners) {
for (RegisteredListener listener : listeners) {
register(listener);
}
}
/**
* Remove a listener from a specific order slot
*
* @param listener listener to remove
*/
public void unregister(RegisteredListener listener) {
if (handlerslots.get(listener.getPriority()).contains(listener)) {
baked = false;
handlerslots.get(listener.getPriority()).remove(listener);
}
}
void unregister(Plugin plugin) {
boolean changed = false;
for (List<RegisteredListener> list : handlerslots.values()) {
for (ListIterator<RegisteredListener> i = list.listIterator(); i.hasNext();) {
if (i.next().getPlugin().equals(plugin)) {
i.remove();
changed = true;
}
}
}
if (changed) baked = false;
}
/**
* Bake HashMap and ArrayLists to 2d array - does nothing if not necessary
*/
public void bake() {
if (baked) return; // don't re-bake when still valid
for (Entry<EventPriority, ArrayList<RegisteredListener>> entry : handlerslots.entrySet()) {
handlers[entry.getKey().getSlot()] = (entry.getValue().toArray(new RegisteredListener[entry.getValue().size()]));
}
baked = true;
}
public RegisteredListener[][] getRegisteredListeners() {
return handlers;
}
}

Datei anzeigen

@ -0,0 +1,18 @@
package org.bukkit.event;
/**
* A transitional class to avoid breaking plugins using custom events.
*/
@Deprecated
public class TransitionalCustomEvent extends Event {
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

Datei anzeigen

@ -3,6 +3,7 @@ package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when a block is broken by a player. * Called when a block is broken by a player.
@ -16,6 +17,7 @@ import org.bukkit.event.Cancellable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockBreakEvent extends BlockEvent implements Cancellable { public class BlockBreakEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Player player; private Player player;
private boolean cancel; private boolean cancel;
@ -41,4 +43,13 @@ public class BlockBreakEvent extends BlockEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancel = cancel; this.cancel = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,6 +2,7 @@ package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when a block is destroyed as a result of being burnt by fire. * Called when a block is destroyed as a result of being burnt by fire.
@ -10,6 +11,7 @@ import org.bukkit.event.Cancellable;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockBurnEvent extends BlockEvent implements Cancellable { public class BlockBurnEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
public BlockBurnEvent(Block block) { public BlockBurnEvent(Block block) {
@ -24,4 +26,13 @@ public class BlockBurnEvent extends BlockEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancelled = cancel; this.cancelled = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,6 +2,7 @@ package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.event.HandlerList;
/** /**
* Called when we try to place a block, to see if we can build it here or not. * Called when we try to place a block, to see if we can build it here or not.
@ -14,6 +15,7 @@ import org.bukkit.Material;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockCanBuildEvent extends BlockEvent { public class BlockCanBuildEvent extends BlockEvent {
private static final HandlerList handlers = new HandlerList();
protected boolean buildable; protected boolean buildable;
protected int material; protected int material;
@ -59,4 +61,13 @@ public class BlockCanBuildEvent extends BlockEvent {
public int getMaterialId() { public int getMaterialId() {
return material; return material;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,6 +3,7 @@ package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
/** /**
@ -12,6 +13,7 @@ import org.bukkit.inventory.ItemStack;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockDamageEvent extends BlockEvent implements Cancellable { public class BlockDamageEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Player player; private Player player;
private boolean instaBreak; private boolean instaBreak;
private boolean cancel; private boolean cancel;
@ -68,4 +70,13 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancel = cancel; this.cancel = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,6 +2,7 @@ package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -12,6 +13,7 @@ import org.bukkit.util.Vector;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockDispenseEvent extends BlockEvent implements Cancellable { public class BlockDispenseEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false; private boolean cancelled = false;
private ItemStack item; private ItemStack item;
@ -69,4 +71,13 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
cancelled = cancel; cancelled = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -7,7 +7,7 @@ import org.bukkit.event.Event;
* Represents a block related event. * Represents a block related event.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockEvent extends Event { public abstract class BlockEvent extends Event {
protected Block block; protected Block block;
public BlockEvent(final Event.Type type, final Block theBlock) { public BlockEvent(final Event.Type type, final Block theBlock) {

Datei anzeigen

@ -3,6 +3,7 @@ package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when a block fades, melts or disappears based on world conditions * Called when a block fades, melts or disappears based on world conditions
@ -17,6 +18,7 @@ import org.bukkit.event.Cancellable;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockFadeEvent extends BlockEvent implements Cancellable { public class BlockFadeEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private BlockState newState; private BlockState newState;
@ -42,4 +44,13 @@ public class BlockFadeEvent extends BlockEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancelled = cancel; this.cancelled = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,6 +3,7 @@ package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when a block is formed or spreads based on world conditions. * Called when a block is formed or spreads based on world conditions.
@ -20,6 +21,7 @@ import org.bukkit.event.Cancellable;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockFormEvent extends BlockEvent implements Cancellable { public class BlockFormEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private BlockState newState; private BlockState newState;
@ -53,4 +55,13 @@ public class BlockFormEvent extends BlockEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancelled = cancel; this.cancelled = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,6 +3,7 @@ package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Represents events with a source block and a destination block, currently only applies to liquid (lava and water). * Represents events with a source block and a destination block, currently only applies to liquid (lava and water).
@ -11,6 +12,7 @@ import org.bukkit.event.Cancellable;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockFromToEvent extends BlockEvent implements Cancellable { public class BlockFromToEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
protected Block to; protected Block to;
protected BlockFace face; protected BlockFace face;
protected boolean cancel; protected boolean cancel;
@ -49,4 +51,13 @@ public class BlockFromToEvent extends BlockEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancel = cancel; this.cancel = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -4,6 +4,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/** /**
* Called when a block is ignited. If you want to catch when a Player places fire, you need to use {@link BlockPlaceEvent}. * Called when a block is ignited. If you want to catch when a Player places fire, you need to use {@link BlockPlaceEvent}.
@ -12,6 +13,7 @@ import org.bukkit.event.Event;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockIgniteEvent extends BlockEvent implements Cancellable { public class BlockIgniteEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private IgniteCause cause; private IgniteCause cause;
private boolean cancel; private boolean cancel;
private Player thePlayer; private Player thePlayer;
@ -71,4 +73,13 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable {
*/ */
LIGHTNING, LIGHTNING,
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -5,6 +5,7 @@ import org.bukkit.event.Listener;
/** /**
* Handles all events thrown in relation to Blocks * Handles all events thrown in relation to Blocks
*/ */
@Deprecated
public class BlockListener implements Listener { public class BlockListener implements Listener {
/** /**

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Thrown when a block physics check is called * Thrown when a block physics check is called
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockPhysicsEvent extends BlockEvent implements Cancellable { public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final int changed; private final int changed;
private boolean cancel = false; private boolean cancel = false;
@ -42,4 +44,13 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancel = cancel; this.cancel = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -6,9 +6,11 @@ import java.util.List;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockPistonExtendEvent extends BlockPistonEvent { public class BlockPistonExtendEvent extends BlockPistonEvent {
private static final HandlerList handlers = new HandlerList();
private int length; private int length;
private List<Block> blocks; private List<Block> blocks;
@ -42,4 +44,13 @@ public class BlockPistonExtendEvent extends BlockPistonEvent {
} }
return blocks; return blocks;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,9 +3,11 @@ package org.bukkit.event.block;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockPistonRetractEvent extends BlockPistonEvent { public class BlockPistonRetractEvent extends BlockPistonEvent {
private static final HandlerList handlers = new HandlerList();
public BlockPistonRetractEvent(Block block, BlockFace direction) { public BlockPistonRetractEvent(Block block, BlockFace direction) {
super(Type.BLOCK_PISTON_RETRACT, block, direction); super(Type.BLOCK_PISTON_RETRACT, block, direction);
} }
@ -19,4 +21,13 @@ public class BlockPistonRetractEvent extends BlockPistonEvent {
public Location getRetractLocation() { public Location getRetractLocation() {
return getBlock().getRelative(getDirection(), 2).getLocation(); return getBlock().getRelative(getDirection(), 2).getLocation();
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -4,6 +4,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
/** /**
@ -13,6 +14,7 @@ import org.bukkit.inventory.ItemStack;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockPlaceEvent extends BlockEvent implements Cancellable { public class BlockPlaceEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
protected boolean cancel; protected boolean cancel;
protected boolean canBuild; protected boolean canBuild;
protected Block placedAgainst; protected Block placedAgainst;
@ -106,4 +108,13 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
public void setBuild(boolean canBuild) { public void setBuild(boolean canBuild) {
this.canBuild = canBuild; this.canBuild = canBuild;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -1,12 +1,14 @@
package org.bukkit.event.block; package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.event.HandlerList;
/** /**
* Called when a redstone current changes * Called when a redstone current changes
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockRedstoneEvent extends BlockEvent { public class BlockRedstoneEvent extends BlockEvent {
private static final HandlerList handlers = new HandlerList();
private int oldCurrent; private int oldCurrent;
private int newCurrent; private int newCurrent;
@ -42,4 +44,13 @@ public class BlockRedstoneEvent extends BlockEvent {
public void setNewCurrent(int newCurrent) { public void setNewCurrent(int newCurrent) {
this.newCurrent = newCurrent; this.newCurrent = newCurrent;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,6 +2,7 @@ package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.event.HandlerList;
/** /**
* Called when a block spreads based on world conditions. * Called when a block spreads based on world conditions.
@ -19,6 +20,7 @@ import org.bukkit.block.BlockState;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockSpreadEvent extends BlockFormEvent { public class BlockSpreadEvent extends BlockFormEvent {
private static final HandlerList handlers = new HandlerList();
private Block source; private Block source;
public BlockSpreadEvent(Block block, Block source, BlockState newState) { public BlockSpreadEvent(Block block, Block source, BlockState newState) {
@ -34,4 +36,13 @@ public class BlockSpreadEvent extends BlockFormEvent {
public Block getSource() { public Block getSource() {
return source; return source;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,6 +2,7 @@ package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when leaves are decaying naturally. * Called when leaves are decaying naturally.
@ -10,6 +11,7 @@ import org.bukkit.event.Cancellable;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class LeavesDecayEvent extends BlockEvent implements Cancellable { public class LeavesDecayEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel = false; private boolean cancel = false;
public LeavesDecayEvent(final Block block) { public LeavesDecayEvent(final Block block) {
@ -23,4 +25,13 @@ public class LeavesDecayEvent extends BlockEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancel = cancel; this.cancel = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,6 +3,7 @@ package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when a sign is changed by a player. * Called when a sign is changed by a player.
@ -11,6 +12,7 @@ import org.bukkit.event.Cancellable;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class SignChangeEvent extends BlockEvent implements Cancellable { public class SignChangeEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel = false; private boolean cancel = false;
private Player player; private Player player;
private String[] lines; private String[] lines;
@ -68,4 +70,13 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancel = cancel; this.cancel = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -4,6 +4,7 @@ import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when a creature is spawned into a world. * Called when a creature is spawned into a world.
@ -12,6 +13,7 @@ import org.bukkit.event.Cancellable;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class CreatureSpawnEvent extends EntityEvent implements Cancellable { public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Location location; private Location location;
private boolean canceled; private boolean canceled;
@ -60,6 +62,15 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
return spawnReason; return spawnReason;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
/** /**
* An enum to specify the type of spawning * An enum to specify the type of spawning
*/ */

Datei anzeigen

@ -2,6 +2,7 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when a Creeper is struck by lightning. * Called when a Creeper is struck by lightning.
@ -10,6 +11,7 @@ import org.bukkit.event.Cancellable;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class CreeperPowerEvent extends EntityEvent implements Cancellable { public class CreeperPowerEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean canceled; private boolean canceled;
private PowerCause cause; private PowerCause cause;
@ -53,6 +55,15 @@ public class CreeperPowerEvent extends EntityEvent implements Cancellable {
return cause; return cause;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
/** /**
* An enum to specify the cause of the change in power * An enum to specify the cause of the change in power
*/ */

Datei anzeigen

@ -3,9 +3,11 @@ package org.bukkit.event.entity;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EndermanPickupEvent extends EntityEvent implements Cancellable { public class EndermanPickupEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel; private boolean cancel;
private Block block; private Block block;
@ -32,4 +34,13 @@ public class EndermanPickupEvent extends EntityEvent implements Cancellable {
public Block getBlock() { public Block getBlock() {
return block; return block;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,9 +3,11 @@ package org.bukkit.event.entity;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EndermanPlaceEvent extends EntityEvent implements Cancellable { public class EndermanPlaceEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel; private boolean cancel;
private Location location; private Location location;
@ -32,4 +34,13 @@ public class EndermanPlaceEvent extends EntityEvent implements Cancellable {
public Location getLocation() { public Location getLocation() {
return location; return location;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,6 +2,7 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when an entity combusts. * Called when an entity combusts.
@ -10,6 +11,7 @@ import org.bukkit.event.Cancellable;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityCombustEvent extends EntityEvent implements Cancellable { public class EntityCombustEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private int duration; private int duration;
private boolean cancel; private boolean cancel;
@ -44,4 +46,13 @@ public class EntityCombustEvent extends EntityEvent implements Cancellable {
public void setDuration(int duration) { public void setDuration(int duration) {
this.duration = duration; this.duration = duration;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -5,11 +5,13 @@ import org.bukkit.PortalType;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Thrown when a Living Entity creates a portal in a world. * Thrown when a Living Entity creates a portal in a world.
*/ */
public class EntityCreatePortalEvent extends EntityEvent implements Cancellable { public class EntityCreatePortalEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private List<BlockState> blocks; private List<BlockState> blocks;
private boolean cancelled = false; private boolean cancelled = false;
private PortalType type = PortalType.CUSTOM; private PortalType type = PortalType.CUSTOM;
@ -46,4 +48,13 @@ public class EntityCreatePortalEvent extends EntityEvent implements Cancellable
public PortalType getPortalType() { public PortalType getPortalType() {
return type; return type;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/** /**
* Stores data for damage events * Stores data for damage events
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityDamageEvent extends EntityEvent implements Cancellable { public class EntityDamageEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private int damage; private int damage;
private boolean cancelled; private boolean cancelled;
@ -61,6 +63,15 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
return cause; return cause;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
/** /**
* An enum to specify the cause of the damage * An enum to specify the cause of the damage
*/ */

Datei anzeigen

@ -2,6 +2,7 @@ package org.bukkit.event.entity;
import java.util.List; import java.util.List;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
/** /**
@ -9,6 +10,7 @@ import org.bukkit.inventory.ItemStack;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityDeathEvent extends EntityEvent { public class EntityDeathEvent extends EntityEvent {
private static final HandlerList handlers = new HandlerList();
private List<ItemStack> drops; private List<ItemStack> drops;
private int dropExp = 0; private int dropExp = 0;
@ -54,4 +56,13 @@ public class EntityDeathEvent extends EntityEvent {
public List<ItemStack> getDrops() { public List<ItemStack> getDrops() {
return drops; return drops;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -7,7 +7,7 @@ import org.bukkit.event.Event;
* Represents an Entity-related event * Represents an Entity-related event
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityEvent extends Event { public abstract class EntityEvent extends Event {
protected Entity entity; protected Entity entity;
public EntityEvent(final Event.Type type, final Entity what) { public EntityEvent(final Event.Type type, final Entity what) {

Datei anzeigen

@ -4,6 +4,7 @@ import org.bukkit.Location;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import java.util.List; import java.util.List;
@ -12,6 +13,7 @@ import java.util.List;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityExplodeEvent extends EntityEvent implements Cancellable { public class EntityExplodeEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel; private boolean cancel;
private Location location; private Location location;
private List<Block> blocks; private List<Block> blocks;
@ -76,4 +78,13 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable {
public void setYield(float yield) { public void setYield(float yield) {
this.yield = yield; this.yield = yield;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.entity;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when an entity interacts with an object * Called when an entity interacts with an object
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityInteractEvent extends EntityEvent implements Cancellable { public class EntityInteractEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
protected Block block; protected Block block;
private boolean cancelled; private boolean cancelled;
@ -34,4 +36,13 @@ public class EntityInteractEvent extends EntityEvent implements Cancellable {
public Block getBlock() { public Block getBlock() {
return block; return block;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -7,6 +7,7 @@ import org.bukkit.event.painting.PaintingBreakEvent;
/** /**
* Handles all events fired in relation to entities * Handles all events fired in relation to entities
*/ */
@Deprecated
public class EntityListener implements Listener { public class EntityListener implements Listener {
public EntityListener() {} public EntityListener() {}

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.event.HandlerList;
/** /**
* Stores data for entities standing inside a portal block * Stores data for entities standing inside a portal block
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityPortalEnterEvent extends EntityEvent { public class EntityPortalEnterEvent extends EntityEvent {
private static final HandlerList handlers = new HandlerList();
private Location location; private Location location;
@ -24,4 +26,13 @@ public class EntityPortalEnterEvent extends EntityEvent {
public Location getLocation() { public Location getLocation() {
return location; return location;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/** /**
* Stores data for health-regain events * Stores data for health-regain events
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityRegainHealthEvent extends EntityEvent implements Cancellable { public class EntityRegainHealthEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private int amount; private int amount;
@ -55,6 +57,15 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
return regainReason; return regainReason;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
/** /**
* An enum to specify the type of health regaining that is occurring * An enum to specify the type of health regaining that is occurring
*/ */

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.entity;
import org.bukkit.entity.AnimalTamer; import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Thrown when a LivingEntity is tamed * Thrown when a LivingEntity is tamed
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityTameEvent extends EntityEvent implements Cancellable { public class EntityTameEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private AnimalTamer owner; private AnimalTamer owner;
@ -33,4 +35,13 @@ public class EntityTameEvent extends EntityEvent implements Cancellable {
public AnimalTamer getOwner() { public AnimalTamer getOwner() {
return owner; return owner;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when a creature targets or untargets another entity * Called when a creature targets or untargets another entity
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityTargetEvent extends EntityEvent implements Cancellable { public class EntityTargetEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel; private boolean cancel;
private Entity target; private Entity target;
private TargetReason reason; private TargetReason reason;
@ -62,6 +64,15 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
this.target = target; this.target = target;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
/** /**
* An enum to specify the reason for the targeting * An enum to specify the reason for the targeting
*/ */

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Explosive; import org.bukkit.entity.Explosive;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when an entity has made a decision to explode. * Called when an entity has made a decision to explode.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ExplosionPrimeEvent extends EntityEvent implements Cancellable { public class ExplosionPrimeEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel; private boolean cancel;
private float radius; private float radius;
private boolean fire; private boolean fire;
@ -67,4 +69,13 @@ public class ExplosionPrimeEvent extends EntityEvent implements Cancellable {
public void setFire(boolean fire) { public void setFire(boolean fire) {
this.fire = fire; this.fire = fire;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when a human entity's food level changes * Called when a human entity's food level changes
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FoodLevelChangeEvent extends EntityEvent implements Cancellable { public class FoodLevelChangeEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel = false; private boolean cancel = false;
private int level; private int level;
@ -46,4 +48,13 @@ public class FoodLevelChangeEvent extends EntityEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancel = cancel; this.cancel = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,8 +3,10 @@ package org.bukkit.event.entity;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
public class ItemDespawnEvent extends EntityEvent implements Cancellable { public class ItemDespawnEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean canceled; private boolean canceled;
private Location location; private Location location;
@ -29,4 +31,13 @@ public class ItemDespawnEvent extends EntityEvent implements Cancellable {
public Location getLocation() { public Location getLocation() {
return location; return location;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when an item is spawned into a world * Called when an item is spawned into a world
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ItemSpawnEvent extends EntityEvent implements Cancellable { public class ItemSpawnEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Location location; private Location location;
private boolean canceled; private boolean canceled;
@ -34,4 +36,13 @@ public class ItemSpawnEvent extends EntityEvent implements Cancellable {
public Location getLocation() { public Location getLocation() {
return location; return location;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Stores data for pigs being zapped * Stores data for pigs being zapped
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PigZapEvent extends EntityEvent implements Cancellable { public class PigZapEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean canceled; private boolean canceled;
private Entity pigzombie; private Entity pigzombie;
@ -45,4 +47,13 @@ public class PigZapEvent extends EntityEvent implements Cancellable {
public Entity getPigZombie() { public Entity getPigZombie() {
return pigzombie; return pigzombie;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -1,15 +1,26 @@
package org.bukkit.event.entity; package org.bukkit.event.entity;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.event.HandlerList;
/** /**
* Called when a projectile hits an object * Called when a projectile hits an object
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ProjectileHitEvent extends EntityEvent { public class ProjectileHitEvent extends EntityEvent {
private static final HandlerList handlers = new HandlerList();
public ProjectileHitEvent(Projectile projectile) { public ProjectileHitEvent(Projectile projectile) {
super(Type.PROJECTILE_HIT, projectile); super(Type.PROJECTILE_HIT, projectile);
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when a Slime splits into smaller Slimes upon death * Called when a Slime splits into smaller Slimes upon death
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class SlimeSplitEvent extends EntityEvent implements Cancellable { public class SlimeSplitEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel; private boolean cancel;
private int count; private int count;
@ -42,4 +44,13 @@ public class SlimeSplitEvent extends EntityEvent implements Cancellable {
public void setCount(int count) { public void setCount(int count) {
this.count = count; this.count = count;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,6 +3,7 @@ package org.bukkit.event.inventory;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
/** /**
@ -10,6 +11,7 @@ import org.bukkit.inventory.ItemStack;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FurnaceBurnEvent extends Event implements Cancellable { public class FurnaceBurnEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Block furnace; private Block furnace;
private ItemStack fuel; private ItemStack fuel;
private int burnTime; private int burnTime;
@ -87,4 +89,13 @@ public class FurnaceBurnEvent extends Event implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancelled = cancel; this.cancelled = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,6 +3,7 @@ package org.bukkit.event.inventory;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
/** /**
@ -10,6 +11,7 @@ import org.bukkit.inventory.ItemStack;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FurnaceSmeltEvent extends Event implements Cancellable { public class FurnaceSmeltEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Block furnace; private Block furnace;
private ItemStack source; private ItemStack source;
private ItemStack result; private ItemStack result;
@ -67,4 +69,13 @@ public class FurnaceSmeltEvent extends Event implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancelled = cancel; this.cancelled = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -5,6 +5,7 @@ import org.bukkit.event.Listener;
/** /**
* Handles all events thrown in relation to Blocks * Handles all events thrown in relation to Blocks
*/ */
@Deprecated
public class InventoryListener implements Listener { public class InventoryListener implements Listener {
public InventoryListener() {} public InventoryListener() {}

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.painting;
import org.bukkit.entity.Painting; import org.bukkit.entity.Painting;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Triggered when a painting is removed * Triggered when a painting is removed
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PaintingBreakEvent extends PaintingEvent implements Cancellable { public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private RemoveCause cause; private RemoveCause cause;
@ -59,4 +61,13 @@ public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
*/ */
PHYSICS, PHYSICS,
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -7,7 +7,7 @@ import org.bukkit.event.Event;
* Represents a painting-related event. * Represents a painting-related event.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PaintingEvent extends Event { public abstract class PaintingEvent extends Event {
protected Painting painting; protected Painting painting;

Datei anzeigen

@ -6,12 +6,14 @@ import org.bukkit.entity.Painting;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/** /**
* Triggered when a painting is created in the world * Triggered when a painting is created in the world
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PaintingPlaceEvent extends PaintingEvent implements Cancellable { public class PaintingPlaceEvent extends PaintingEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
@ -60,4 +62,13 @@ public class PaintingPlaceEvent extends PaintingEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancelled = cancel; this.cancelled = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.player;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Represents a player animation event * Represents a player animation event
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerAnimationEvent extends PlayerEvent implements Cancellable { public class PlayerAnimationEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private PlayerAnimationType animationType; private PlayerAnimationType animationType;
private boolean isCancelled = false; private boolean isCancelled = false;
@ -40,4 +42,13 @@ public class PlayerAnimationEvent extends PlayerEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.isCancelled = cancel; this.isCancelled = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.player;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* This event is fired when the player is almost about to enter the bed. * This event is fired when the player is almost about to enter the bed.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable { public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel = false; private boolean cancel = false;
private Block bed; private Block bed;
@ -34,4 +36,13 @@ public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable {
public Block getBed() { public Block getBed() {
return bed; return bed;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.player;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
/** /**
* This event is fired when the player is leaving a bed. * This event is fired when the player is leaving a bed.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerBedLeaveEvent extends PlayerEvent { public class PlayerBedLeaveEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private Block bed; private Block bed;
@ -24,4 +26,13 @@ public class PlayerBedLeaveEvent extends PlayerEvent {
public Block getBed() { public Block getBed() {
return bed; return bed;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -4,6 +4,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
/** /**
@ -11,8 +12,18 @@ import org.bukkit.inventory.ItemStack;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerBucketEmptyEvent extends PlayerBucketEvent { public class PlayerBucketEmptyEvent extends PlayerBucketEvent {
private static final HandlerList handlers = new HandlerList();
public PlayerBucketEmptyEvent(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) { public PlayerBucketEmptyEvent(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) {
super(Type.PLAYER_BUCKET_EMPTY, who, blockClicked, blockFace, bucket, itemInHand); super(Type.PLAYER_BUCKET_EMPTY, who, blockClicked, blockFace, bucket, itemInHand);
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -4,6 +4,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
/** /**
@ -11,7 +12,17 @@ import org.bukkit.inventory.ItemStack;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerBucketFillEvent extends PlayerBucketEvent { public class PlayerBucketFillEvent extends PlayerBucketEvent {
private static final HandlerList handlers = new HandlerList();
public PlayerBucketFillEvent(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) { public PlayerBucketFillEvent(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) {
super(Type.PLAYER_BUCKET_FILL, who, blockClicked, blockFace, bucket, itemInHand); super(Type.PLAYER_BUCKET_FILL, who, blockClicked, blockFace, bucket, itemInHand);
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,9 +2,11 @@ package org.bukkit.event.player;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerChangedWorldEvent extends PlayerEvent { public class PlayerChangedWorldEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private final World from; private final World from;
@ -16,4 +18,13 @@ public class PlayerChangedWorldEvent extends PlayerEvent {
public World getFrom() { public World getFrom() {
return from; return from;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -6,12 +6,14 @@ import java.util.Set;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Holds information for player chat and commands * Holds information for player chat and commands
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerChatEvent extends PlayerEvent implements Cancellable { public class PlayerChatEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel = false; private boolean cancel = false;
private String message; private String message;
private String format = "<%1$s> %2$s"; private String format = "<%1$s> %2$s";
@ -97,4 +99,13 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable {
public Set<Player> getRecipients() { public Set<Player> getRecipients() {
return recipients; return recipients;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -1,6 +1,7 @@
package org.bukkit.event.player; package org.bukkit.event.player;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
/** /**
* Called early in the command handling process. This event is only * Called early in the command handling process. This event is only
@ -8,7 +9,17 @@ import org.bukkit.entity.Player;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerCommandPreprocessEvent extends PlayerChatEvent { public class PlayerCommandPreprocessEvent extends PlayerChatEvent {
private static final HandlerList handlers = new HandlerList();
public PlayerCommandPreprocessEvent(final Player player, final String message) { public PlayerCommandPreprocessEvent(final Player player, final String message) {
super(Type.PLAYER_COMMAND_PREPROCESS, player, message); super(Type.PLAYER_COMMAND_PREPROCESS, player, message);
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.player;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Thrown when a player drops an item from their inventory * Thrown when a player drops an item from their inventory
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerDropItemEvent extends PlayerEvent implements Cancellable { public class PlayerDropItemEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Item drop; private final Item drop;
private boolean cancel = false; private boolean cancel = false;
@ -33,4 +35,13 @@ public class PlayerDropItemEvent extends PlayerEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancel = cancel; this.cancel = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.player;
import org.bukkit.entity.CreatureType; import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Egg; import org.bukkit.entity.Egg;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
/** /**
* Called when a player throws an egg and it might hatch * Called when a player throws an egg and it might hatch
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerEggThrowEvent extends PlayerEvent { public class PlayerEggThrowEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private Egg egg; private Egg egg;
private boolean hatching; private boolean hatching;
private CreatureType hatchType; private CreatureType hatchType;
@ -94,4 +96,13 @@ public class PlayerEggThrowEvent extends PlayerEvent {
public void setNumHatches(byte numHatches) { public void setNumHatches(byte numHatches) {
this.numHatches = numHatches; this.numHatches = numHatches;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -7,7 +7,7 @@ import org.bukkit.event.Event;
* Represents a player related event * Represents a player related event
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerEvent extends Event { public abstract class PlayerEvent extends Event {
protected Player player; protected Player player;
public PlayerEvent(final Event.Type type, final Player who) { public PlayerEvent(final Event.Type type, final Player who) {

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.player;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.HandlerList;
/** /**
* Thrown when a player is fishing * Thrown when a player is fishing
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerFishEvent extends PlayerEvent implements Cancellable { public class PlayerFishEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Entity entity; private final Entity entity;
private boolean cancel = false; private boolean cancel = false;
private State state; private State state;
@ -45,6 +47,15 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
return state; return state;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
/** /**
* An enum to specify the state of the fishing * An enum to specify the state of the fishing
*/ */

Datei anzeigen

@ -3,9 +3,11 @@ package org.bukkit.event.player;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellable { public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private GameMode newGameMode; private GameMode newGameMode;
@ -26,4 +28,13 @@ public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellabl
public GameMode getNewGameMode() { public GameMode getNewGameMode() {
return newGameMode; return newGameMode;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.player;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Represents an event that is called when a player right clicks an entity. * Represents an event that is called when a player right clicks an entity.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerInteractEntityEvent extends PlayerEvent implements Cancellable { public class PlayerInteractEntityEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
protected Entity clickedEntity; protected Entity clickedEntity;
boolean cancelled = false; boolean cancelled = false;
@ -33,4 +35,13 @@ public class PlayerInteractEntityEvent extends PlayerEvent implements Cancellabl
public Entity getRightClicked() { public Entity getRightClicked() {
return this.clickedEntity; return this.clickedEntity;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,6 +2,7 @@ package org.bukkit.event.player;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -13,6 +14,7 @@ import org.bukkit.event.block.Action;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerInteractEvent extends PlayerEvent implements Cancellable { public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
protected ItemStack item; protected ItemStack item;
protected Action action; protected Action action;
protected Block blockClicked; protected Block blockClicked;
@ -173,4 +175,13 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
public void setUseItemInHand(Result useItemInHand) { public void setUseItemInHand(Result useItemInHand) {
this.useItemInHand = useItemInHand; this.useItemInHand = useItemInHand;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -1,6 +1,7 @@
package org.bukkit.event.player; package org.bukkit.event.player;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
/** /**
@ -8,6 +9,7 @@ import org.bukkit.inventory.Inventory;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerInventoryEvent extends PlayerEvent { public class PlayerInventoryEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
protected Inventory inventory; protected Inventory inventory;
public PlayerInventoryEvent(final Player player, final Inventory inventory) { public PlayerInventoryEvent(final Player player, final Inventory inventory) {
@ -23,4 +25,13 @@ public class PlayerInventoryEvent extends PlayerEvent {
public Inventory getInventory() { public Inventory getInventory() {
return inventory; return inventory;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -1,12 +1,14 @@
package org.bukkit.event.player; package org.bukkit.event.player;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
/** /**
* Fired when a player changes their currently held item * Fired when a player changes their currently held item
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerItemHeldEvent extends PlayerEvent { public class PlayerItemHeldEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private int previous; private int previous;
private int current; private int current;
@ -33,4 +35,13 @@ public class PlayerItemHeldEvent extends PlayerEvent {
public int getNewSlot() { public int getNewSlot() {
return current; return current;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -1,12 +1,14 @@
package org.bukkit.event.player; package org.bukkit.event.player;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
/** /**
* Called when a player joins a server * Called when a player joins a server
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerJoinEvent extends PlayerEvent { public class PlayerJoinEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private String joinMessage; private String joinMessage;
public PlayerJoinEvent(Player playerJoined, String joinMessage) { public PlayerJoinEvent(Player playerJoined, String joinMessage) {
@ -31,4 +33,13 @@ public class PlayerJoinEvent extends PlayerEvent {
public void setJoinMessage(String joinMessage) { public void setJoinMessage(String joinMessage) {
this.joinMessage = joinMessage; this.joinMessage = joinMessage;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.player;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when a player gets kicked from the server * Called when a player gets kicked from the server
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerKickEvent extends PlayerEvent implements Cancellable { public class PlayerKickEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private String leaveMessage; private String leaveMessage;
private String kickReason; private String kickReason;
private Boolean cancel; private Boolean cancel;
@ -62,4 +64,13 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
public void setLeaveMessage(String leaveMessage) { public void setLeaveMessage(String leaveMessage) {
this.leaveMessage = leaveMessage; this.leaveMessage = leaveMessage;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -5,6 +5,7 @@ import org.bukkit.event.Listener;
/** /**
* Handles all events thrown in relation to a Player * Handles all events thrown in relation to a Player
*/ */
@Deprecated
public class PlayerListener implements Listener { public class PlayerListener implements Listener {
public PlayerListener() {} public PlayerListener() {}

Datei anzeigen

@ -1,12 +1,14 @@
package org.bukkit.event.player; package org.bukkit.event.player;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
/** /**
* Stores details for players attempting to log in * Stores details for players attempting to log in
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerLoginEvent extends PlayerEvent { public class PlayerLoginEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private Result result; private Result result;
private String message; private String message;
@ -77,6 +79,15 @@ public class PlayerLoginEvent extends PlayerEvent {
this.message = message; this.message = message;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
/** /**
* Basic kick reasons for communicating to plugins * Basic kick reasons for communicating to plugins
*/ */

Datei anzeigen

@ -4,12 +4,14 @@ import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/** /**
* Holds information for player movement events * Holds information for player movement events
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerMoveEvent extends PlayerEvent implements Cancellable { public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel = false; private boolean cancel = false;
private Location from; private Location from;
private Location to; private Location to;
@ -89,4 +91,13 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
public void setTo(Location to) { public void setTo(Location to) {
this.to = to; this.to = to;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.player;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Thrown when a player picks an item up from the ground * Thrown when a player picks an item up from the ground
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable { public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Item item; private final Item item;
private boolean cancel = false; private boolean cancel = false;
private int remaining; private int remaining;
@ -44,4 +46,13 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancel = cancel; this.cancel = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.player;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.TravelAgent; import org.bukkit.TravelAgent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
/** /**
* Called when a player completes the portaling process by standing in a portal * Called when a player completes the portaling process by standing in a portal
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerPortalEvent extends PlayerTeleportEvent { public class PlayerPortalEvent extends PlayerTeleportEvent {
private static final HandlerList handlers = new HandlerList();
protected boolean useTravelAgent = true; protected boolean useTravelAgent = true;
@ -35,4 +37,13 @@ public class PlayerPortalEvent extends PlayerTeleportEvent {
public void setPortalTravelAgent(TravelAgent travelAgent) { public void setPortalTravelAgent(TravelAgent travelAgent) {
this.travelAgent = travelAgent; this.travelAgent = travelAgent;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.player;
import java.net.InetAddress; import java.net.InetAddress;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/** /**
* Stores details for players attempting to log in * Stores details for players attempting to log in
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerPreLoginEvent extends Event { public class PlayerPreLoginEvent extends Event {
private static final HandlerList handlers = new HandlerList();
private Result result; private Result result;
private String message; private String message;
private String name; private String name;
@ -94,6 +96,15 @@ public class PlayerPreLoginEvent extends Event {
return ipAddress; return ipAddress;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
/** /**
* Basic kick reasons for communicating to plugins * Basic kick reasons for communicating to plugins
*/ */

Datei anzeigen

@ -1,12 +1,14 @@
package org.bukkit.event.player; package org.bukkit.event.player;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
/** /**
* Called when a player leaves a server * Called when a player leaves a server
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerQuitEvent extends PlayerEvent { public class PlayerQuitEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private String quitMessage; private String quitMessage;
@ -32,4 +34,13 @@ public class PlayerQuitEvent extends PlayerEvent {
public void setQuitMessage(String quitMessage) { public void setQuitMessage(String quitMessage) {
this.quitMessage = quitMessage; this.quitMessage = quitMessage;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,9 +2,11 @@ package org.bukkit.event.player;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerRespawnEvent extends PlayerEvent { public class PlayerRespawnEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private Location respawnLocation; private Location respawnLocation;
private boolean isBedSpawn; private boolean isBedSpawn;
@ -40,4 +42,13 @@ public class PlayerRespawnEvent extends PlayerEvent {
public boolean isBedSpawn() { public boolean isBedSpawn() {
return this.isBedSpawn; return this.isBedSpawn;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.player;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/** /**
* Holds information for player teleport events * Holds information for player teleport events
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerTeleportEvent extends PlayerMoveEvent { public class PlayerTeleportEvent extends PlayerMoveEvent {
private static final HandlerList handlers = new HandlerList();
private TeleportCause cause = TeleportCause.UNKNOWN; private TeleportCause cause = TeleportCause.UNKNOWN;
public PlayerTeleportEvent(Player player, Location from, Location to) { public PlayerTeleportEvent(Player player, Location from, Location to) {
@ -58,4 +60,13 @@ public class PlayerTeleportEvent extends PlayerMoveEvent {
*/ */
UNKNOWN; UNKNOWN;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.player;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when a player toggles their sneaking state * Called when a player toggles their sneaking state
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable { public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean isSneaking; private boolean isSneaking;
private boolean cancel = false; private boolean cancel = false;
@ -32,4 +34,13 @@ public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancel = cancel; this.cancel = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.player;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Called when a player toggles their sprinting state * Called when a player toggles their sprinting state
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerToggleSprintEvent extends PlayerEvent implements Cancellable { public class PlayerToggleSprintEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean isSprinting; private boolean isSprinting;
private boolean cancel = false; private boolean cancel = false;
@ -32,4 +34,13 @@ public class PlayerToggleSprintEvent extends PlayerEvent implements Cancellable
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancel = cancel; this.cancel = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,10 +3,12 @@ package org.bukkit.event.player;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerVelocityEvent extends PlayerEvent implements Cancellable { public class PlayerVelocityEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
/** /**
* Holds information for player velocity events * Holds information for player velocity events
@ -61,4 +63,13 @@ public class PlayerVelocityEvent extends PlayerEvent implements Cancellable {
public void setVelocity(Vector velocity) { public void setVelocity(Vector velocity) {
this.velocity = velocity; this.velocity = velocity;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -1,6 +1,7 @@
package org.bukkit.event.server; package org.bukkit.event.server;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.map.MapView; import org.bukkit.map.MapView;
/** /**
@ -8,6 +9,7 @@ import org.bukkit.map.MapView;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class MapInitializeEvent extends ServerEvent { public class MapInitializeEvent extends ServerEvent {
private static final HandlerList handlers = new HandlerList();
private final MapView mapView; private final MapView mapView;
public MapInitializeEvent(MapView mapView) { public MapInitializeEvent(MapView mapView) {
@ -23,4 +25,13 @@ public class MapInitializeEvent extends ServerEvent {
public MapView getMap() { public MapView getMap() {
return mapView; return mapView;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -1,5 +1,6 @@
package org.bukkit.event.server; package org.bukkit.event.server;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
/** /**
@ -7,7 +8,17 @@ import org.bukkit.plugin.Plugin;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PluginDisableEvent extends PluginEvent { public class PluginDisableEvent extends PluginEvent {
private static final HandlerList handlers = new HandlerList();
public PluginDisableEvent(Plugin plugin) { public PluginDisableEvent(Plugin plugin) {
super(Type.PLUGIN_DISABLE, plugin); super(Type.PLUGIN_DISABLE, plugin);
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -1,5 +1,6 @@
package org.bukkit.event.server; package org.bukkit.event.server;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
/** /**
@ -7,7 +8,17 @@ import org.bukkit.plugin.Plugin;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PluginEnableEvent extends PluginEvent { public class PluginEnableEvent extends PluginEvent {
private static final HandlerList handlers = new HandlerList();
public PluginEnableEvent(Plugin plugin) { public PluginEnableEvent(Plugin plugin) {
super(Type.PLUGIN_ENABLE, plugin); super(Type.PLUGIN_ENABLE, plugin);
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -6,7 +6,7 @@ import org.bukkit.plugin.Plugin;
* Used for plugin enable and disable events * Used for plugin enable and disable events
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PluginEvent extends ServerEvent { public abstract class PluginEvent extends ServerEvent {
private final Plugin plugin; private final Plugin plugin;
public PluginEvent(final Type type, final Plugin plugin) { public PluginEvent(final Type type, final Plugin plugin) {

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.server;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.event.HandlerList;
/** /**
* Server Command events * Server Command events
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ServerCommandEvent extends ServerEvent { public class ServerCommandEvent extends ServerEvent {
private static final HandlerList handlers = new HandlerList();
private String command; private String command;
private CommandSender sender; private CommandSender sender;
@ -48,4 +50,13 @@ public class ServerCommandEvent extends ServerEvent {
public CommandSender getSender() { public CommandSender getSender() {
return sender; return sender;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -6,7 +6,7 @@ import org.bukkit.event.Event;
* Miscellaneous server events * Miscellaneous server events
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ServerEvent extends Event { public abstract class ServerEvent extends Event {
public ServerEvent(final Type type) { public ServerEvent(final Type type) {
super(type); super(type);
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.server;
import java.net.InetAddress; import java.net.InetAddress;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/** /**
* Called when a server list ping is coming in. * Called when a server list ping is coming in.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ServerListPingEvent extends ServerEvent { public class ServerListPingEvent extends ServerEvent {
private static final HandlerList handlers = new HandlerList();
private InetAddress address; private InetAddress address;
private String motd; private String motd;
@ -76,4 +78,13 @@ public class ServerListPingEvent extends ServerEvent {
public void setMaxPlayers(int maxPlayers) { public void setMaxPlayers(int maxPlayers) {
this.maxPlayers = maxPlayers; this.maxPlayers = maxPlayers;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -5,6 +5,7 @@ import org.bukkit.event.Listener;
/** /**
* Handles all miscellaneous server events * Handles all miscellaneous server events
*/ */
@Deprecated
public class ServerListener implements Listener { public class ServerListener implements Listener {
/** /**

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.event.vehicle;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.event.HandlerList;
/** /**
* Raised when a vehicle collides with a block. * Raised when a vehicle collides with a block.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class VehicleBlockCollisionEvent extends VehicleCollisionEvent { public class VehicleBlockCollisionEvent extends VehicleCollisionEvent {
private static final HandlerList handlers = new HandlerList();
private Block block; private Block block;
public VehicleBlockCollisionEvent(Vehicle vehicle, Block block) { public VehicleBlockCollisionEvent(Vehicle vehicle, Block block) {
@ -23,4 +25,13 @@ public class VehicleBlockCollisionEvent extends VehicleCollisionEvent {
public Block getBlock() { public Block getBlock() {
return block; return block;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -6,7 +6,7 @@ import org.bukkit.entity.Vehicle;
* Raised when a vehicle collides. * Raised when a vehicle collides.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class VehicleCollisionEvent extends VehicleEvent { public abstract class VehicleCollisionEvent extends VehicleEvent {
public VehicleCollisionEvent(Type type, Vehicle vehicle) { public VehicleCollisionEvent(Type type, Vehicle vehicle) {
super(type, vehicle); super(type, vehicle);
} }

Datei anzeigen

@ -1,13 +1,24 @@
package org.bukkit.event.vehicle; package org.bukkit.event.vehicle;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.event.HandlerList;
/** /**
* Raised when a vehicle is created. * Raised when a vehicle is created.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class VehicleCreateEvent extends VehicleEvent { public class VehicleCreateEvent extends VehicleEvent {
private static final HandlerList handlers = new HandlerList();
public VehicleCreateEvent(Vehicle vehicle) { public VehicleCreateEvent(Vehicle vehicle) {
super(Type.VEHICLE_CREATE, vehicle); super(Type.VEHICLE_CREATE, vehicle);
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.vehicle;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Raised when a vehicle receives damage. * Raised when a vehicle receives damage.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class VehicleDamageEvent extends VehicleEvent implements Cancellable { public class VehicleDamageEvent extends VehicleEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Entity attacker; private Entity attacker;
private int damage; private int damage;
private boolean cancelled; private boolean cancelled;
@ -53,4 +55,13 @@ public class VehicleDamageEvent extends VehicleEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancelled = cancel; this.cancelled = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,6 +3,7 @@ package org.bukkit.event.vehicle;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Raised when a vehicle is destroyed, which could be caused by either a player * Raised when a vehicle is destroyed, which could be caused by either a player
@ -11,6 +12,7 @@ import org.bukkit.event.Cancellable;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class VehicleDestroyEvent extends VehicleEvent implements Cancellable { public class VehicleDestroyEvent extends VehicleEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Entity attacker; private Entity attacker;
private boolean cancelled; private boolean cancelled;
@ -35,4 +37,13 @@ public class VehicleDestroyEvent extends VehicleEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancelled = cancel; this.cancelled = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Datei anzeigen

@ -3,12 +3,14 @@ package org.bukkit.event.vehicle;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/** /**
* Raised when an entity enters a vehicle. * Raised when an entity enters a vehicle.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class VehicleEnterEvent extends VehicleEvent implements Cancellable { public class VehicleEnterEvent extends VehicleEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private Entity entered; private Entity entered;
@ -33,4 +35,13 @@ public class VehicleEnterEvent extends VehicleEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancelled = cancel; this.cancelled = cancel;
} }
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
} }

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen