[Bleeding] Changed event system into a new, much faster design. Huge thanks to @zml2008 & @lahwran.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user