mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 18:27:17 +01:00
[Bleeding] Changed event system into a new, much faster design. Huge thanks to @zml2008 & @lahwran.
By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
94bc6ec0e6
commit
e0c7fc6bf5
132 changed files with 1691 additions and 225 deletions
|
@ -5,7 +5,9 @@ import org.bukkit.event.Listener;
|
|||
/**
|
||||
* Handles all custom events
|
||||
*/
|
||||
@Deprecated
|
||||
public class CustomEventListener implements Listener {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
public CustomEventListener() {}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,14 +1,27 @@
|
|||
package org.bukkit.event;
|
||||
|
||||
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
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
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 String name;
|
||||
|
||||
|
@ -16,7 +29,12 @@ public abstract class Event implements Serializable {
|
|||
exAssert(type != null, "type is null");
|
||||
exAssert(type != Type.CUSTOM_EVENT, "use Event(String) to make custom events");
|
||||
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) {
|
||||
|
@ -30,6 +48,7 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @return Event type that this object represents
|
||||
*/
|
||||
@Deprecated
|
||||
public final Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
@ -46,47 +65,73 @@ public abstract class Event implements Serializable {
|
|||
* @return Name of this event
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@Deprecated
|
||||
public enum Priority {
|
||||
|
||||
/**
|
||||
* Event call is of very low importance and should be ran first, to allow
|
||||
* other plugins to further customise the outcome
|
||||
*/
|
||||
Lowest,
|
||||
Lowest(EventPriority.LOWEST),
|
||||
/**
|
||||
* Event call is of low importance
|
||||
*/
|
||||
Low,
|
||||
Low(EventPriority.LOW),
|
||||
/**
|
||||
* Event call is neither important or unimportant, and may be ran normally
|
||||
*/
|
||||
Normal,
|
||||
Normal(EventPriority.NORMAL),
|
||||
/**
|
||||
* Event call is of high importance
|
||||
*/
|
||||
High,
|
||||
High(EventPriority.HIGH),
|
||||
/**
|
||||
* Event call is critical and must have the final say in what happens
|
||||
* to the event
|
||||
*/
|
||||
Highest,
|
||||
Highest(EventPriority.HIGHEST),
|
||||
/**
|
||||
* 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
|
||||
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
|
||||
*/
|
||||
@Deprecated
|
||||
public enum Category {
|
||||
|
||||
/**
|
||||
|
@ -136,6 +181,7 @@ public abstract class Event implements Serializable {
|
|||
/**
|
||||
* Provides a lookup for all core events
|
||||
*/
|
||||
@Deprecated
|
||||
public enum Type {
|
||||
|
||||
/**
|
||||
|
@ -147,178 +193,176 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.player.PlayerLoginEvent
|
||||
*/
|
||||
PLAYER_LOGIN(Category.PLAYER),
|
||||
PLAYER_LOGIN(Category.PLAYER, PlayerLoginEvent.class),
|
||||
/**
|
||||
* Called when a player has just been authenticated
|
||||
*
|
||||
* @see org.bukkit.event.player.PlayerPreLoginEvent
|
||||
*/
|
||||
PLAYER_PRELOGIN(Category.PLAYER),
|
||||
PLAYER_PRELOGIN(Category.PLAYER, PlayerPreLoginEvent.class),
|
||||
/**
|
||||
* Called when a player respawns
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.player.PlayerKickEvent
|
||||
*/
|
||||
PLAYER_KICK(Category.PLAYER),
|
||||
PLAYER_KICK(Category.PLAYER, PlayerKickEvent.class),
|
||||
/**
|
||||
* Called when a player sends a chat message
|
||||
*
|
||||
* @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)
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
* get "pushed" into a specific direction, e.g. after an explosion
|
||||
*
|
||||
* @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)
|
||||
*
|
||||
* @see org.bukkit.event.player.PlayerAnimationEvent
|
||||
*/
|
||||
PLAYER_ANIMATION(Category.PLAYER),
|
||||
PLAYER_ANIMATION(Category.PLAYER, PlayerAnimationEvent.class),
|
||||
/**
|
||||
* Called when a player toggles sneak mode
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.player.PlayerInteractEvent
|
||||
*/
|
||||
PLAYER_INTERACT(Category.PLAYER),
|
||||
PLAYER_INTERACT(Category.PLAYER, PlayerInteractEvent.class),
|
||||
/**
|
||||
* Called when a player right clicks an entity
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.player.PlayerPortalEvent
|
||||
*/
|
||||
PLAYER_PORTAL(Category.PLAYER),
|
||||
PLAYER_PORTAL(Category.PLAYER, PlayerPortalEvent.class),
|
||||
/**
|
||||
* Called when a player changes their held item
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.player.PlayerInventoryEvent
|
||||
*/
|
||||
PLAYER_INVENTORY(Category.PLAYER),
|
||||
PLAYER_INVENTORY(Category.PLAYER, PlayerInventoryEvent.class),
|
||||
/**
|
||||
* Called when a player enter a bed
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.player.PlayerBedLeaveEvent
|
||||
*/
|
||||
PLAYER_BED_LEAVE(Category.PLAYER),
|
||||
PLAYER_BED_LEAVE(Category.PLAYER, PlayerBedLeaveEvent.class),
|
||||
/**
|
||||
* Called when a player is fishing
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.player.PlayerChangedWorldEvent
|
||||
*/
|
||||
PLAYER_CHANGED_WORLD(Category.PLAYER),
|
||||
PLAYER_CHANGED_WORLD(Category.PLAYER, PlayerChangedWorldEvent.class),
|
||||
|
||||
/**
|
||||
* BLOCK EVENTS
|
||||
|
@ -329,7 +373,7 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @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
|
||||
* check on whether it can be built
|
||||
|
@ -338,21 +382,21 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @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
|
||||
* block
|
||||
*
|
||||
* @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
|
||||
* an adjacent block of fire attempting to set fire to wood
|
||||
*
|
||||
* @see org.bukkit.event.block.BlockIgniteEvent
|
||||
*/
|
||||
BLOCK_IGNITE(Category.BLOCK),
|
||||
BLOCK_IGNITE(Category.BLOCK, BlockIgniteEvent.class),
|
||||
/**
|
||||
* Called when a block undergoes a physics check
|
||||
* <p />
|
||||
|
@ -361,37 +405,37 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.block.BlockPlaceEvent
|
||||
*/
|
||||
BLOCK_PLACE(Category.BLOCK),
|
||||
BLOCK_PLACE(Category.BLOCK, BlockPlaceEvent.class),
|
||||
/**
|
||||
* Called when a block dispenses something
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.block.BlockBurnEvent
|
||||
*/
|
||||
BLOCK_BURN(Category.BLOCK),
|
||||
BLOCK_BURN(Category.BLOCK, BlockBurnEvent.class),
|
||||
/**
|
||||
* Called when leaves are decaying naturally
|
||||
*
|
||||
* @see org.bukkit.event.block.LeavesDecayEvent
|
||||
*/
|
||||
LEAVES_DECAY(Category.BLOCK),
|
||||
LEAVES_DECAY(Category.BLOCK, LeavesDecayEvent.class),
|
||||
/**
|
||||
* Called when a sign is changed
|
||||
*
|
||||
* @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
|
||||
* 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
|
||||
*/
|
||||
REDSTONE_CHANGE(Category.BLOCK),
|
||||
REDSTONE_CHANGE(Category.BLOCK, BlockRedstoneEvent.class),
|
||||
/**
|
||||
* Called when a block is broken by a player
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.block.BlockFadeEvent
|
||||
*/
|
||||
BLOCK_FADE(Category.BLOCK),
|
||||
BLOCK_FADE(Category.BLOCK, BlockFadeEvent.class),
|
||||
/**
|
||||
* Called when a piston extends
|
||||
*
|
||||
* @see org.bukkit.event.block.BlockPistonExtendEvent
|
||||
*/
|
||||
BLOCK_PISTON_EXTEND(Category.BLOCK),
|
||||
BLOCK_PISTON_EXTEND(Category.BLOCK, BlockPistonExtendEvent.class),
|
||||
/**
|
||||
* Called when a piston retracts
|
||||
*
|
||||
* @see org.bukkit.event.block.BlockPistonRetractEvent
|
||||
*/
|
||||
BLOCK_PISTON_RETRACT(Category.BLOCK),
|
||||
|
||||
BLOCK_PISTON_RETRACT(Category.BLOCK, BlockPistonRetractEvent.class),
|
||||
/**
|
||||
* INVENTORY EVENTS
|
||||
*/
|
||||
|
@ -446,44 +489,43 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @todo: add javadoc see comment
|
||||
*/
|
||||
INVENTORY_OPEN(Category.INVENTORY),
|
||||
INVENTORY_OPEN(Category.INVENTORY, null),
|
||||
/**
|
||||
* Called when a player closes an inventory
|
||||
*
|
||||
* @todo: add javadoc see comment
|
||||
*/
|
||||
INVENTORY_CLOSE(Category.INVENTORY),
|
||||
INVENTORY_CLOSE(Category.INVENTORY, null),
|
||||
/**
|
||||
* Called when a player clicks on an inventory slot
|
||||
*
|
||||
* @todo: add javadoc see comment
|
||||
*/
|
||||
INVENTORY_CLICK(Category.INVENTORY),
|
||||
INVENTORY_CLICK(Category.INVENTORY, null),
|
||||
/**
|
||||
* Called when an inventory slot changes values or type
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @todo: add javadoc see comment
|
||||
*/
|
||||
INVENTORY_TRANSACTION(Category.INVENTORY),
|
||||
INVENTORY_TRANSACTION(Category.INVENTORY, null),
|
||||
/**
|
||||
* Called when an ItemStack is successfully smelted in a furnace.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @see org.bukkit.event.inventory.FurnaceBurnEvent
|
||||
*/
|
||||
FURNACE_BURN(Category.INVENTORY),
|
||||
|
||||
FURNACE_BURN(Category.INVENTORY, FurnaceBurnEvent.class),
|
||||
/**
|
||||
* SERVER EVENTS
|
||||
*/
|
||||
|
@ -493,37 +535,37 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @see org.bukkit.event.server.PluginEnableEvent
|
||||
*/
|
||||
PLUGIN_ENABLE(Category.SERVER),
|
||||
PLUGIN_ENABLE(Category.SERVER, PluginEnableEvent.class),
|
||||
/**
|
||||
* Called when a plugin is disabled
|
||||
*
|
||||
* @see org.bukkit.event.server.PluginDisableEvent
|
||||
*/
|
||||
PLUGIN_DISABLE(Category.SERVER),
|
||||
PLUGIN_DISABLE(Category.SERVER, PluginDisableEvent.class),
|
||||
/**
|
||||
* Called when a server command is called
|
||||
*
|
||||
* @see org.bukkit.event.server.ServerCommandEvent
|
||||
*/
|
||||
SERVER_COMMAND(Category.SERVER),
|
||||
SERVER_COMMAND(Category.SERVER, ServerCommandEvent.class),
|
||||
/**
|
||||
* Called when a remote server command is called
|
||||
*
|
||||
* @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)
|
||||
*
|
||||
* @see org.bukkit.event.server.MapInitializeEvent
|
||||
*/
|
||||
MAP_INITIALIZE(Category.SERVER),
|
||||
MAP_INITIALIZE(Category.SERVER, MapInitializeEvent.class),
|
||||
/**
|
||||
* Called when a client pings a server.
|
||||
*
|
||||
* @see org.bukkit.event.server.ServerListPingEvent
|
||||
*/
|
||||
SERVER_LIST_PING(Category.SERVER),
|
||||
SERVER_LIST_PING(Category.SERVER, ServerListPingEvent.class),
|
||||
|
||||
/**
|
||||
* WORLD EVENTS
|
||||
|
@ -537,13 +579,13 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @see org.bukkit.event.world.ChunkLoadEvent
|
||||
*/
|
||||
CHUNK_LOAD(Category.WORLD),
|
||||
CHUNK_LOAD(Category.WORLD, ChunkLoadEvent.class),
|
||||
/**
|
||||
* Called when a chunk is unloaded
|
||||
*
|
||||
* @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.
|
||||
* <p />
|
||||
|
@ -551,61 +593,61 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @see org.bukkit.event.world.ChunkPopulateEvent
|
||||
*/
|
||||
CHUNK_POPULATED(Category.WORLD),
|
||||
CHUNK_POPULATED(Category.WORLD, ChunkPopulateEvent.class),
|
||||
/**
|
||||
* Called when an ItemEntity spawns in the world
|
||||
*
|
||||
* @see org.bukkit.event.entity.ItemSpawnEvent
|
||||
*/
|
||||
ITEM_SPAWN(Category.WORLD),
|
||||
ITEM_SPAWN(Category.WORLD, ItemSpawnEvent.class),
|
||||
/**
|
||||
* Called when a World's spawn is changed
|
||||
*
|
||||
* @see org.bukkit.event.world.SpawnChangeEvent
|
||||
*/
|
||||
SPAWN_CHANGE(Category.WORLD),
|
||||
SPAWN_CHANGE(Category.WORLD, SpawnChangeEvent.class),
|
||||
/**
|
||||
* Called when a world is saved
|
||||
*
|
||||
* @see org.bukkit.event.world.WorldSaveEvent
|
||||
*/
|
||||
WORLD_SAVE(Category.WORLD),
|
||||
WORLD_SAVE(Category.WORLD, WorldSaveEvent.class),
|
||||
/**
|
||||
* Called when a World is initializing
|
||||
*
|
||||
* @see org.bukkit.event.world.WorldInitEvent
|
||||
*/
|
||||
WORLD_INIT(Category.WORLD),
|
||||
WORLD_INIT(Category.WORLD, WorldInitEvent.class),
|
||||
/**
|
||||
* Called when a World is loaded
|
||||
*
|
||||
* @see org.bukkit.event.world.WorldLoadEvent
|
||||
*/
|
||||
WORLD_LOAD(Category.WORLD),
|
||||
WORLD_LOAD(Category.WORLD, WorldLoadEvent.class),
|
||||
/**
|
||||
* Called when a World is unloaded
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @see org.bukkit.event.world.StructureGrowEvent
|
||||
*/
|
||||
STRUCTURE_GROW(Category.WORLD),
|
||||
STRUCTURE_GROW(Category.WORLD, StructureGrowEvent.class),
|
||||
/**
|
||||
* Called when an item despawns from a world
|
||||
*
|
||||
* @see org.bukkit.event.entity.ItemDespawnEvent
|
||||
*/
|
||||
ITEM_DESPAWN(Category.WORLD),
|
||||
ITEM_DESPAWN(Category.WORLD, ItemDespawnEvent.class),
|
||||
|
||||
/**
|
||||
* ENTITY EVENTS
|
||||
|
@ -616,19 +658,19 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @see org.bukkit.event.painting.PaintingPlaceEvent
|
||||
*/
|
||||
PAINTING_PLACE(Category.ENTITY),
|
||||
PAINTING_PLACE(Category.ENTITY, PaintingPlaceEvent.class),
|
||||
/**
|
||||
* Called when a painting is removed
|
||||
*
|
||||
* @see org.bukkit.event.painting.PaintingBreakEvent
|
||||
*/
|
||||
PAINTING_BREAK(Category.ENTITY),
|
||||
PAINTING_BREAK(Category.ENTITY, PaintingBreakEvent.class),
|
||||
/**
|
||||
* Called when an entity touches a portal block
|
||||
*
|
||||
* @see org.bukkit.event.entity.EntityPortalEnterEvent
|
||||
*/
|
||||
ENTITY_PORTAL_ENTER(Category.ENTITY),
|
||||
ENTITY_PORTAL_ENTER(Category.ENTITY, EntityPortalEnterEvent.class),
|
||||
|
||||
/**
|
||||
* LIVING_ENTITY EVENTS
|
||||
|
@ -640,31 +682,31 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @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.
|
||||
*
|
||||
* @see org.bukkit.event.entity.EntityDamageEvent
|
||||
*/
|
||||
ENTITY_DAMAGE(Category.LIVING_ENTITY),
|
||||
ENTITY_DAMAGE(Category.LIVING_ENTITY, EntityDamageEvent.class),
|
||||
/**
|
||||
* Called when a LivingEntity dies
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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.
|
||||
* <p />
|
||||
|
@ -677,80 +719,80 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
* This event specifically excludes player entities
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.entity.PigZapEvent
|
||||
*/
|
||||
PIG_ZAP(Category.LIVING_ENTITY),
|
||||
PIG_ZAP(Category.LIVING_ENTITY, PigZapEvent.class),
|
||||
/**
|
||||
* Called when a LivingEntity is tamed
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.entity.EntityCreatePortalEvent
|
||||
*/
|
||||
ENTITY_CREATE_PORTAL(Category.LIVING_ENTITY),
|
||||
ENTITY_CREATE_PORTAL(Category.LIVING_ENTITY, EntityCreatePortalEvent.class),
|
||||
|
||||
/**
|
||||
* WEATHER EVENTS
|
||||
|
@ -761,19 +803,19 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @see org.bukkit.event.weather.LightningStrikeEvent
|
||||
*/
|
||||
LIGHTNING_STRIKE(Category.WEATHER),
|
||||
LIGHTNING_STRIKE(Category.WEATHER, LightningStrikeEvent.class),
|
||||
/**
|
||||
* Called when the weather in a world changes
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.weather.ThunderChangeEvent
|
||||
*/
|
||||
THUNDER_CHANGE(Category.WEATHER),
|
||||
THUNDER_CHANGE(Category.WEATHER, ThunderChangeEvent.class),
|
||||
|
||||
/**
|
||||
* VEHICLE EVENTS
|
||||
|
@ -784,55 +826,55 @@ public abstract class Event implements Serializable {
|
|||
*
|
||||
* @see org.bukkit.event.vehicle.VehicleCreateEvent
|
||||
*/
|
||||
VEHICLE_CREATE(Category.VEHICLE),
|
||||
VEHICLE_CREATE(Category.VEHICLE, VehicleCreateEvent.class),
|
||||
/**
|
||||
* Called when a vehicle is destroyed
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.vehicle.VehicleDamageEvent
|
||||
*/
|
||||
VEHICLE_DAMAGE(Category.VEHICLE),
|
||||
VEHICLE_DAMAGE(Category.VEHICLE, VehicleDamageEvent.class),
|
||||
/**
|
||||
* Called when a vehicle collides with an Entity
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @see org.bukkit.event.vehicle.VehicleUpdateEvent
|
||||
*/
|
||||
VEHICLE_UPDATE(Category.VEHICLE),
|
||||
VEHICLE_UPDATE(Category.VEHICLE, VehicleUpdateEvent.class),
|
||||
/**
|
||||
* MISCELLANEOUS EVENTS
|
||||
*/
|
||||
|
@ -840,12 +882,18 @@ public abstract class Event implements Serializable {
|
|||
/**
|
||||
* 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 Class<? extends Event> clazz;
|
||||
|
||||
private Type(Category category) {
|
||||
private Type(Category category, Class<? extends Event> clazz) {
|
||||
this.category = category;
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -856,6 +904,10 @@ public abstract class Event implements Serializable {
|
|||
public Category getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public Class<? extends Event> getEventClass() {
|
||||
return clazz;
|
||||
}
|
||||
}
|
||||
|
||||
public enum Result {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.bukkit.event;
|
||||
|
||||
public class EventException extends Exception {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private static final long serialVersionUID = 3532808232324183999L;
|
||||
private final Throwable cause;
|
||||
|
||||
|
|
15
paper-api/src/main/java/org/bukkit/event/EventHandler.java
Normal file
15
paper-api/src/main/java/org/bukkit/event/EventHandler.java
Normal file
|
@ -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();
|
||||
}
|
45
paper-api/src/main/java/org/bukkit/event/EventPriority.java
Normal file
45
paper-api/src/main/java/org/bukkit/event/EventPriority.java
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
133
paper-api/src/main/java/org/bukkit/event/HandlerList.java
Normal file
133
paper-api/src/main/java/org/bukkit/event/HandlerList.java
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package org.bukkit.event.block;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a block is broken by a player.
|
||||
|
@ -16,6 +17,7 @@ import org.bukkit.event.Cancellable;
|
|||
@SuppressWarnings("serial")
|
||||
public class BlockBreakEvent extends BlockEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Player player;
|
||||
private boolean cancel;
|
||||
|
||||
|
@ -41,4 +43,13 @@ public class BlockBreakEvent extends BlockEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.bukkit.event.block;
|
|||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* 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")
|
||||
public class BlockBurnEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
public BlockBurnEvent(Block block) {
|
||||
|
@ -24,4 +26,13 @@ public class BlockBurnEvent extends BlockEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.bukkit.event.block;
|
|||
|
||||
import org.bukkit.block.Block;
|
||||
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.
|
||||
|
@ -14,6 +15,7 @@ import org.bukkit.Material;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockCanBuildEvent extends BlockEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected boolean buildable;
|
||||
protected int material;
|
||||
|
||||
|
@ -59,4 +61,13 @@ public class BlockCanBuildEvent extends BlockEvent {
|
|||
public int getMaterialId() {
|
||||
return material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.bukkit.event.block;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
|
@ -12,6 +13,7 @@ import org.bukkit.inventory.ItemStack;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockDamageEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Player player;
|
||||
private boolean instaBreak;
|
||||
private boolean cancel;
|
||||
|
@ -68,4 +70,13 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.bukkit.event.block;
|
|||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
|
@ -12,6 +13,7 @@ import org.bukkit.util.Vector;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean cancelled = false;
|
||||
private ItemStack item;
|
||||
|
@ -69,4 +71,13 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.bukkit.event.Event;
|
|||
* Represents a block related event.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockEvent extends Event {
|
||||
public abstract class BlockEvent extends Event {
|
||||
protected Block block;
|
||||
|
||||
public BlockEvent(final Event.Type type, final Block theBlock) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.bukkit.event.block;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a block fades, melts or disappears based on world conditions
|
||||
|
@ -17,6 +18,7 @@ import org.bukkit.event.Cancellable;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockFadeEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private BlockState newState;
|
||||
|
||||
|
@ -42,4 +44,13 @@ public class BlockFadeEvent extends BlockEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.bukkit.event.block;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a block is formed or spreads based on world conditions.
|
||||
|
@ -20,6 +21,7 @@ import org.bukkit.event.Cancellable;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockFormEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private BlockState newState;
|
||||
|
||||
|
@ -53,4 +55,13 @@ public class BlockFormEvent extends BlockEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.bukkit.event.block;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
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).
|
||||
|
@ -11,6 +12,7 @@ import org.bukkit.event.Cancellable;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected Block to;
|
||||
protected BlockFace face;
|
||||
protected boolean cancel;
|
||||
|
@ -49,4 +51,13 @@ public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.bukkit.block.Block;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
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}.
|
||||
|
@ -12,6 +13,7 @@ import org.bukkit.event.Event;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private IgniteCause cause;
|
||||
private boolean cancel;
|
||||
private Player thePlayer;
|
||||
|
@ -71,4 +73,13 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
|||
*/
|
||||
LIGHTNING,
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.bukkit.event.Listener;
|
|||
/**
|
||||
* Handles all events thrown in relation to Blocks
|
||||
*/
|
||||
@Deprecated
|
||||
public class BlockListener implements Listener {
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.block;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Thrown when a block physics check is called
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final int changed;
|
||||
private boolean cancel = false;
|
||||
|
||||
|
@ -42,4 +44,13 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import java.util.List;
|
|||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockPistonExtendEvent extends BlockPistonEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private int length;
|
||||
private List<Block> blocks;
|
||||
|
||||
|
@ -42,4 +44,13 @@ public class BlockPistonExtendEvent extends BlockPistonEvent {
|
|||
}
|
||||
return blocks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@ package org.bukkit.event.block;
|
|||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockPistonRetractEvent extends BlockPistonEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
public BlockPistonRetractEvent(Block block, BlockFace direction) {
|
||||
super(Type.BLOCK_PISTON_RETRACT, block, direction);
|
||||
}
|
||||
|
@ -19,4 +21,13 @@ public class BlockPistonRetractEvent extends BlockPistonEvent {
|
|||
public Location getRetractLocation() {
|
||||
return getBlock().getRelative(getDirection(), 2).getLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.bukkit.block.Block;
|
|||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
|
@ -13,6 +14,7 @@ import org.bukkit.inventory.ItemStack;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected boolean cancel;
|
||||
protected boolean canBuild;
|
||||
protected Block placedAgainst;
|
||||
|
@ -106,4 +108,13 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
|||
public void setBuild(boolean canBuild) {
|
||||
this.canBuild = canBuild;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package org.bukkit.event.block;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a redstone current changes
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockRedstoneEvent extends BlockEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private int oldCurrent;
|
||||
private int newCurrent;
|
||||
|
||||
|
@ -42,4 +44,13 @@ public class BlockRedstoneEvent extends BlockEvent {
|
|||
public void setNewCurrent(int newCurrent) {
|
||||
this.newCurrent = newCurrent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.bukkit.event.block;
|
|||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a block spreads based on world conditions.
|
||||
|
@ -19,6 +20,7 @@ import org.bukkit.block.BlockState;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BlockSpreadEvent extends BlockFormEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Block source;
|
||||
|
||||
public BlockSpreadEvent(Block block, Block source, BlockState newState) {
|
||||
|
@ -34,4 +36,13 @@ public class BlockSpreadEvent extends BlockFormEvent {
|
|||
public Block getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.bukkit.event.block;
|
|||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when leaves are decaying naturally.
|
||||
|
@ -10,6 +11,7 @@ import org.bukkit.event.Cancellable;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class LeavesDecayEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel = false;
|
||||
|
||||
public LeavesDecayEvent(final Block block) {
|
||||
|
@ -23,4 +25,13 @@ public class LeavesDecayEvent extends BlockEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.bukkit.event.block;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a sign is changed by a player.
|
||||
|
@ -11,6 +12,7 @@ import org.bukkit.event.Cancellable;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class SignChangeEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel = false;
|
||||
private Player player;
|
||||
private String[] lines;
|
||||
|
@ -68,4 +70,13 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.bukkit.entity.CreatureType;
|
|||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a creature is spawned into a world.
|
||||
|
@ -12,6 +13,7 @@ import org.bukkit.event.Cancellable;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Location location;
|
||||
private boolean canceled;
|
||||
|
@ -60,6 +62,15 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
|||
return spawnReason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum to specify the type of spawning
|
||||
*/
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.bukkit.event.entity;
|
|||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a Creeper is struck by lightning.
|
||||
|
@ -10,6 +11,7 @@ import org.bukkit.event.Cancellable;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CreeperPowerEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean canceled;
|
||||
private PowerCause cause;
|
||||
|
@ -53,6 +55,15 @@ public class CreeperPowerEvent extends EntityEvent implements Cancellable {
|
|||
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
|
||||
*/
|
||||
|
|
|
@ -3,9 +3,11 @@ package org.bukkit.event.entity;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class EndermanPickupEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean cancel;
|
||||
private Block block;
|
||||
|
@ -32,4 +34,13 @@ public class EndermanPickupEvent extends EntityEvent implements Cancellable {
|
|||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@ package org.bukkit.event.entity;
|
|||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class EndermanPlaceEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean cancel;
|
||||
private Location location;
|
||||
|
@ -32,4 +34,13 @@ public class EndermanPlaceEvent extends EntityEvent implements Cancellable {
|
|||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.bukkit.event.entity;
|
|||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when an entity combusts.
|
||||
|
@ -10,6 +11,7 @@ import org.bukkit.event.Cancellable;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EntityCombustEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private int duration;
|
||||
private boolean cancel;
|
||||
|
||||
|
@ -44,4 +46,13 @@ public class EntityCombustEvent extends EntityEvent implements Cancellable {
|
|||
public void setDuration(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,11 +5,13 @@ import org.bukkit.PortalType;
|
|||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Thrown when a Living Entity creates a portal in a world.
|
||||
*/
|
||||
public class EntityCreatePortalEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private List<BlockState> blocks;
|
||||
private boolean cancelled = false;
|
||||
private PortalType type = PortalType.CUSTOM;
|
||||
|
@ -46,4 +48,13 @@ public class EntityCreatePortalEvent extends EntityEvent implements Cancellable
|
|||
public PortalType getPortalType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.entity;
|
|||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Stores data for damage events
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private int damage;
|
||||
private boolean cancelled;
|
||||
|
@ -61,6 +63,15 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
|||
return cause;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum to specify the cause of the damage
|
||||
*/
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.bukkit.event.entity;
|
|||
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
|
@ -9,6 +10,7 @@ import org.bukkit.inventory.ItemStack;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EntityDeathEvent extends EntityEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private List<ItemStack> drops;
|
||||
private int dropExp = 0;
|
||||
|
||||
|
@ -54,4 +56,13 @@ public class EntityDeathEvent extends EntityEvent {
|
|||
public List<ItemStack> getDrops() {
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.bukkit.event.Event;
|
|||
* Represents an Entity-related event
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EntityEvent extends Event {
|
||||
public abstract class EntityEvent extends Event {
|
||||
protected Entity entity;
|
||||
|
||||
public EntityEvent(final Event.Type type, final Entity what) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.bukkit.Location;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -12,6 +13,7 @@ import java.util.List;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EntityExplodeEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel;
|
||||
private Location location;
|
||||
private List<Block> blocks;
|
||||
|
@ -76,4 +78,13 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable {
|
|||
public void setYield(float yield) {
|
||||
this.yield = yield;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.entity;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when an entity interacts with an object
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EntityInteractEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected Block block;
|
||||
|
||||
private boolean cancelled;
|
||||
|
@ -34,4 +36,13 @@ public class EntityInteractEvent extends EntityEvent implements Cancellable {
|
|||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.bukkit.event.painting.PaintingBreakEvent;
|
|||
/**
|
||||
* Handles all events fired in relation to entities
|
||||
*/
|
||||
@Deprecated
|
||||
public class EntityListener implements Listener {
|
||||
public EntityListener() {}
|
||||
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.entity;
|
|||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Stores data for entities standing inside a portal block
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EntityPortalEnterEvent extends EntityEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Location location;
|
||||
|
||||
|
@ -24,4 +26,13 @@ public class EntityPortalEnterEvent extends EntityEvent {
|
|||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.entity;
|
|||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Stores data for health-regain events
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EntityRegainHealthEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean cancelled;
|
||||
private int amount;
|
||||
|
@ -55,6 +57,15 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
|
|||
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
|
||||
*/
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.entity;
|
|||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Thrown when a LivingEntity is tamed
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EntityTameEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private AnimalTamer owner;
|
||||
|
||||
|
@ -33,4 +35,13 @@ public class EntityTameEvent extends EntityEvent implements Cancellable {
|
|||
public AnimalTamer getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.entity;
|
|||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a creature targets or untargets another entity
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class EntityTargetEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel;
|
||||
private Entity target;
|
||||
private TargetReason reason;
|
||||
|
@ -62,6 +64,15 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
|
|||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum to specify the reason for the targeting
|
||||
*/
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.entity;
|
|||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Explosive;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when an entity has made a decision to explode.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ExplosionPrimeEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel;
|
||||
private float radius;
|
||||
private boolean fire;
|
||||
|
@ -67,4 +69,13 @@ public class ExplosionPrimeEvent extends EntityEvent implements Cancellable {
|
|||
public void setFire(boolean fire) {
|
||||
this.fire = fire;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.entity;
|
|||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a human entity's food level changes
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class FoodLevelChangeEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel = false;
|
||||
private int level;
|
||||
|
||||
|
@ -46,4 +48,13 @@ public class FoodLevelChangeEvent extends EntityEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,10 @@ package org.bukkit.event.entity;
|
|||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class ItemDespawnEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean canceled;
|
||||
private Location location;
|
||||
|
||||
|
@ -29,4 +31,13 @@ public class ItemDespawnEvent extends EntityEvent implements Cancellable {
|
|||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.entity;
|
|||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when an item is spawned into a world
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ItemSpawnEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Location location;
|
||||
private boolean canceled;
|
||||
|
@ -34,4 +36,13 @@ public class ItemSpawnEvent extends EntityEvent implements Cancellable {
|
|||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.entity;
|
|||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Stores data for pigs being zapped
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PigZapEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean canceled;
|
||||
private Entity pigzombie;
|
||||
|
@ -45,4 +47,13 @@ public class PigZapEvent extends EntityEvent implements Cancellable {
|
|||
public Entity getPigZombie() {
|
||||
return pigzombie;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,26 @@
|
|||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a projectile hits an object
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ProjectileHitEvent extends EntityEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public ProjectileHitEvent(Projectile projectile) {
|
||||
super(Type.PROJECTILE_HIT, projectile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.entity;
|
|||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a Slime splits into smaller Slimes upon death
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class SlimeSplitEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel;
|
||||
private int count;
|
||||
|
||||
|
@ -42,4 +44,13 @@ public class SlimeSplitEvent extends EntityEvent implements Cancellable {
|
|||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package org.bukkit.event.inventory;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
|
@ -10,6 +11,7 @@ import org.bukkit.inventory.ItemStack;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class FurnaceBurnEvent extends Event implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Block furnace;
|
||||
private ItemStack fuel;
|
||||
private int burnTime;
|
||||
|
@ -87,4 +89,13 @@ public class FurnaceBurnEvent extends Event implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.bukkit.event.inventory;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
|
@ -10,6 +11,7 @@ import org.bukkit.inventory.ItemStack;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class FurnaceSmeltEvent extends Event implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Block furnace;
|
||||
private ItemStack source;
|
||||
private ItemStack result;
|
||||
|
@ -67,4 +69,13 @@ public class FurnaceSmeltEvent extends Event implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.bukkit.event.Listener;
|
|||
/**
|
||||
* Handles all events thrown in relation to Blocks
|
||||
*/
|
||||
@Deprecated
|
||||
public class InventoryListener implements Listener {
|
||||
public InventoryListener() {}
|
||||
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.painting;
|
|||
|
||||
import org.bukkit.entity.Painting;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Triggered when a painting is removed
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean cancelled;
|
||||
private RemoveCause cause;
|
||||
|
@ -59,4 +61,13 @@ public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
|
|||
*/
|
||||
PHYSICS,
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.bukkit.event.Event;
|
|||
* Represents a painting-related event.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PaintingEvent extends Event {
|
||||
public abstract class PaintingEvent extends Event {
|
||||
|
||||
protected Painting painting;
|
||||
|
||||
|
|
|
@ -6,12 +6,14 @@ import org.bukkit.entity.Painting;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Triggered when a painting is created in the world
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PaintingPlaceEvent extends PaintingEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
|
@ -60,4 +62,13 @@ public class PaintingPlaceEvent extends PaintingEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.player;
|
|||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Represents a player animation event
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerAnimationEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private PlayerAnimationType animationType;
|
||||
private boolean isCancelled = false;
|
||||
|
@ -40,4 +42,13 @@ public class PlayerAnimationEvent extends PlayerEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.isCancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.player;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* This event is fired when the player is almost about to enter the bed.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean cancel = false;
|
||||
private Block bed;
|
||||
|
@ -34,4 +36,13 @@ public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable {
|
|||
public Block getBed() {
|
||||
return bed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.player;
|
|||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* This event is fired when the player is leaving a bed.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerBedLeaveEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Block bed;
|
||||
|
||||
|
@ -24,4 +26,13 @@ public class PlayerBedLeaveEvent extends PlayerEvent {
|
|||
public Block getBed() {
|
||||
return bed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.bukkit.Material;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
|
@ -11,8 +12,18 @@ import org.bukkit.inventory.ItemStack;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerBucketEmptyEvent extends PlayerBucketEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
public PlayerBucketEmptyEvent(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) {
|
||||
super(Type.PLAYER_BUCKET_EMPTY, who, blockClicked, blockFace, bucket, itemInHand);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.bukkit.Material;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
|
@ -11,7 +12,17 @@ import org.bukkit.inventory.ItemStack;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerBucketFillEvent extends PlayerBucketEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
public PlayerBucketFillEvent(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) {
|
||||
super(Type.PLAYER_BUCKET_FILL, who, blockClicked, blockFace, bucket, itemInHand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,11 @@ package org.bukkit.event.player;
|
|||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerChangedWorldEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private final World from;
|
||||
|
||||
|
@ -16,4 +18,13 @@ public class PlayerChangedWorldEvent extends PlayerEvent {
|
|||
public World getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,12 +6,14 @@ import java.util.Set;
|
|||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Holds information for player chat and commands
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel = false;
|
||||
private String message;
|
||||
private String format = "<%1$s> %2$s";
|
||||
|
@ -97,4 +99,13 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
|||
public Set<Player> getRecipients() {
|
||||
return recipients;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called early in the command handling process. This event is only
|
||||
|
@ -8,7 +9,17 @@ import org.bukkit.entity.Player;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerCommandPreprocessEvent extends PlayerChatEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
public PlayerCommandPreprocessEvent(final Player player, final String message) {
|
||||
super(Type.PLAYER_COMMAND_PREPROCESS, player, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.player;
|
|||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Thrown when a player drops an item from their inventory
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerDropItemEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Item drop;
|
||||
private boolean cancel = false;
|
||||
|
||||
|
@ -33,4 +35,13 @@ public class PlayerDropItemEvent extends PlayerEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.player;
|
|||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player throws an egg and it might hatch
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerEggThrowEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Egg egg;
|
||||
private boolean hatching;
|
||||
private CreatureType hatchType;
|
||||
|
@ -94,4 +96,13 @@ public class PlayerEggThrowEvent extends PlayerEvent {
|
|||
public void setNumHatches(byte numHatches) {
|
||||
this.numHatches = numHatches;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.bukkit.event.Event;
|
|||
* Represents a player related event
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerEvent extends Event {
|
||||
public abstract class PlayerEvent extends Event {
|
||||
protected Player player;
|
||||
|
||||
public PlayerEvent(final Event.Type type, final Player who) {
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.player;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Thrown when a player is fishing
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Entity entity;
|
||||
private boolean cancel = false;
|
||||
private State state;
|
||||
|
@ -45,6 +47,15 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
|||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum to specify the state of the fishing
|
||||
*/
|
||||
|
|
|
@ -3,9 +3,11 @@ package org.bukkit.event.player;
|
|||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean cancelled;
|
||||
private GameMode newGameMode;
|
||||
|
@ -26,4 +28,13 @@ public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellabl
|
|||
public GameMode getNewGameMode() {
|
||||
return newGameMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.player;
|
|||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Represents an event that is called when a player right clicks an entity.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerInteractEntityEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected Entity clickedEntity;
|
||||
boolean cancelled = false;
|
||||
|
||||
|
@ -33,4 +35,13 @@ public class PlayerInteractEntityEvent extends PlayerEvent implements Cancellabl
|
|||
public Entity getRightClicked() {
|
||||
return this.clickedEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.bukkit.event.player;
|
|||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -13,6 +14,7 @@ import org.bukkit.event.block.Action;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected ItemStack item;
|
||||
protected Action action;
|
||||
protected Block blockClicked;
|
||||
|
@ -173,4 +175,13 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
|||
public void setUseItemInHand(Result useItemInHand) {
|
||||
this.useItemInHand = useItemInHand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
|
@ -8,6 +9,7 @@ import org.bukkit.inventory.Inventory;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerInventoryEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected Inventory inventory;
|
||||
|
||||
public PlayerInventoryEvent(final Player player, final Inventory inventory) {
|
||||
|
@ -23,4 +25,13 @@ public class PlayerInventoryEvent extends PlayerEvent {
|
|||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Fired when a player changes their currently held item
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerItemHeldEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private int previous;
|
||||
private int current;
|
||||
|
||||
|
@ -33,4 +35,13 @@ public class PlayerItemHeldEvent extends PlayerEvent {
|
|||
public int getNewSlot() {
|
||||
return current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player joins a server
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerJoinEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private String joinMessage;
|
||||
|
||||
public PlayerJoinEvent(Player playerJoined, String joinMessage) {
|
||||
|
@ -31,4 +33,13 @@ public class PlayerJoinEvent extends PlayerEvent {
|
|||
public void setJoinMessage(String joinMessage) {
|
||||
this.joinMessage = joinMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.player;
|
|||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player gets kicked from the server
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerKickEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private String leaveMessage;
|
||||
private String kickReason;
|
||||
private Boolean cancel;
|
||||
|
@ -62,4 +64,13 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
|
|||
public void setLeaveMessage(String leaveMessage) {
|
||||
this.leaveMessage = leaveMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.bukkit.event.Listener;
|
|||
/**
|
||||
* Handles all events thrown in relation to a Player
|
||||
*/
|
||||
@Deprecated
|
||||
public class PlayerListener implements Listener {
|
||||
public PlayerListener() {}
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Stores details for players attempting to log in
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerLoginEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Result result;
|
||||
private String message;
|
||||
|
||||
|
@ -77,6 +79,15 @@ public class PlayerLoginEvent extends PlayerEvent {
|
|||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic kick reasons for communicating to plugins
|
||||
*/
|
||||
|
|
|
@ -4,12 +4,14 @@ import org.bukkit.Location;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Holds information for player movement events
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel = false;
|
||||
private Location from;
|
||||
private Location to;
|
||||
|
@ -89,4 +91,13 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
|
|||
public void setTo(Location to) {
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.player;
|
|||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Thrown when a player picks an item up from the ground
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Item item;
|
||||
private boolean cancel = false;
|
||||
private int remaining;
|
||||
|
@ -44,4 +46,13 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.player;
|
|||
import org.bukkit.Location;
|
||||
import org.bukkit.TravelAgent;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player completes the portaling process by standing in a portal
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerPortalEvent extends PlayerTeleportEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
protected boolean useTravelAgent = true;
|
||||
|
||||
|
@ -35,4 +37,13 @@ public class PlayerPortalEvent extends PlayerTeleportEvent {
|
|||
public void setPortalTravelAgent(TravelAgent travelAgent) {
|
||||
this.travelAgent = travelAgent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.player;
|
|||
|
||||
import java.net.InetAddress;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Stores details for players attempting to log in
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerPreLoginEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Result result;
|
||||
private String message;
|
||||
private String name;
|
||||
|
@ -94,6 +96,15 @@ public class PlayerPreLoginEvent extends Event {
|
|||
return ipAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic kick reasons for communicating to plugins
|
||||
*/
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player leaves a server
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerQuitEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private String quitMessage;
|
||||
|
||||
|
@ -32,4 +34,13 @@ public class PlayerQuitEvent extends PlayerEvent {
|
|||
public void setQuitMessage(String quitMessage) {
|
||||
this.quitMessage = quitMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,11 @@ package org.bukkit.event.player;
|
|||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerRespawnEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Location respawnLocation;
|
||||
private boolean isBedSpawn;
|
||||
|
||||
|
@ -40,4 +42,13 @@ public class PlayerRespawnEvent extends PlayerEvent {
|
|||
public boolean isBedSpawn() {
|
||||
return this.isBedSpawn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.player;
|
|||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Holds information for player teleport events
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerTeleportEvent extends PlayerMoveEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private TeleportCause cause = TeleportCause.UNKNOWN;
|
||||
|
||||
public PlayerTeleportEvent(Player player, Location from, Location to) {
|
||||
|
@ -58,4 +60,13 @@ public class PlayerTeleportEvent extends PlayerMoveEvent {
|
|||
*/
|
||||
UNKNOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.player;
|
|||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player toggles their sneaking state
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean isSneaking;
|
||||
private boolean cancel = false;
|
||||
|
||||
|
@ -32,4 +34,13 @@ public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.player;
|
|||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player toggles their sprinting state
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerToggleSprintEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean isSprinting;
|
||||
private boolean cancel = false;
|
||||
|
||||
|
@ -32,4 +34,13 @@ public class PlayerToggleSprintEvent extends PlayerEvent implements Cancellable
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
|
@ -3,10 +3,12 @@ package org.bukkit.event.player;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class PlayerVelocityEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
/**
|
||||
* Holds information for player velocity events
|
||||
|
@ -61,4 +63,13 @@ public class PlayerVelocityEvent extends PlayerEvent implements Cancellable {
|
|||
public void setVelocity(Vector velocity) {
|
||||
this.velocity = velocity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.bukkit.event.server;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.map.MapView;
|
||||
|
||||
/**
|
||||
|
@ -8,6 +9,7 @@ import org.bukkit.map.MapView;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MapInitializeEvent extends ServerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final MapView mapView;
|
||||
|
||||
public MapInitializeEvent(MapView mapView) {
|
||||
|
@ -23,4 +25,13 @@ public class MapInitializeEvent extends ServerEvent {
|
|||
public MapView getMap() {
|
||||
return mapView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.bukkit.event.server;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
|
@ -7,7 +8,17 @@ import org.bukkit.plugin.Plugin;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PluginDisableEvent extends PluginEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
public PluginDisableEvent(Plugin plugin) {
|
||||
super(Type.PLUGIN_DISABLE, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.bukkit.event.server;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
|
@ -7,7 +8,17 @@ import org.bukkit.plugin.Plugin;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PluginEnableEvent extends PluginEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
public PluginEnableEvent(Plugin plugin) {
|
||||
super(Type.PLUGIN_ENABLE, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.bukkit.plugin.Plugin;
|
|||
* Used for plugin enable and disable events
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PluginEvent extends ServerEvent {
|
||||
public abstract class PluginEvent extends ServerEvent {
|
||||
private final Plugin plugin;
|
||||
|
||||
public PluginEvent(final Type type, final Plugin plugin) {
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.server;
|
|||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Server Command events
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ServerCommandEvent extends ServerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private String command;
|
||||
private CommandSender sender;
|
||||
|
||||
|
@ -48,4 +50,13 @@ public class ServerCommandEvent extends ServerEvent {
|
|||
public CommandSender getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.bukkit.event.Event;
|
|||
* Miscellaneous server events
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ServerEvent extends Event {
|
||||
public abstract class ServerEvent extends Event {
|
||||
public ServerEvent(final Type type) {
|
||||
super(type);
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.server;
|
|||
import java.net.InetAddress;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a server list ping is coming in.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ServerListPingEvent extends ServerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private InetAddress address;
|
||||
private String motd;
|
||||
|
@ -76,4 +78,13 @@ public class ServerListPingEvent extends ServerEvent {
|
|||
public void setMaxPlayers(int maxPlayers) {
|
||||
this.maxPlayers = maxPlayers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.bukkit.event.Listener;
|
|||
/**
|
||||
* Handles all miscellaneous server events
|
||||
*/
|
||||
@Deprecated
|
||||
public class ServerListener implements Listener {
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.bukkit.event.vehicle;
|
|||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Raised when a vehicle collides with a block.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class VehicleBlockCollisionEvent extends VehicleCollisionEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Block block;
|
||||
|
||||
public VehicleBlockCollisionEvent(Vehicle vehicle, Block block) {
|
||||
|
@ -23,4 +25,13 @@ public class VehicleBlockCollisionEvent extends VehicleCollisionEvent {
|
|||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Vehicle;
|
|||
* Raised when a vehicle collides.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class VehicleCollisionEvent extends VehicleEvent {
|
||||
public abstract class VehicleCollisionEvent extends VehicleEvent {
|
||||
public VehicleCollisionEvent(Type type, Vehicle vehicle) {
|
||||
super(type, vehicle);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,24 @@
|
|||
package org.bukkit.event.vehicle;
|
||||
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Raised when a vehicle is created.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class VehicleCreateEvent extends VehicleEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
public VehicleCreateEvent(Vehicle vehicle) {
|
||||
super(Type.VEHICLE_CREATE, vehicle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.vehicle;
|
|||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Raised when a vehicle receives damage.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class VehicleDamageEvent extends VehicleEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Entity attacker;
|
||||
private int damage;
|
||||
private boolean cancelled;
|
||||
|
@ -53,4 +55,13 @@ public class VehicleDamageEvent extends VehicleEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.bukkit.event.vehicle;
|
|||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* 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")
|
||||
public class VehicleDestroyEvent extends VehicleEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Entity attacker;
|
||||
private boolean cancelled;
|
||||
|
||||
|
@ -35,4 +37,13 @@ public class VehicleDestroyEvent extends VehicleEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.bukkit.event.vehicle;
|
|||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Raised when an entity enters a vehicle.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class VehicleEnterEvent extends VehicleEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private Entity entered;
|
||||
|
||||
|
@ -33,4 +35,13 @@ public class VehicleEnterEvent extends VehicleEvent implements Cancellable {
|
|||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue