Deprecation cleanup.

This commit is contained in:
Erik Broes
2012-01-30 21:32:48 +01:00
committed by EvilSeph
parent 52822729b0
commit 7a06777e19
165 changed files with 409 additions and 4280 deletions

View File

@@ -15,13 +15,13 @@ import org.bukkit.event.HandlerList;
public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Location location;
private final Location location;
private boolean canceled;
private CreatureType creatureType;
private SpawnReason spawnReason;
private final CreatureType creatureType;
private final SpawnReason spawnReason;
public CreatureSpawnEvent(Entity spawnee, CreatureType mobtype, Location loc, SpawnReason spawnReason) {
super(Type.CREATURE_SPAWN, spawnee);
public CreatureSpawnEvent(final Entity spawnee, final CreatureType mobtype, final Location loc, final SpawnReason spawnReason) {
super(spawnee);
this.creatureType = mobtype;
this.location = loc;
this.spawnReason = spawnReason;

View File

@@ -14,19 +14,17 @@ public class CreeperPowerEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean canceled;
private PowerCause cause;
private final PowerCause cause;
private Entity bolt;
public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
super(Type.CREEPER_POWER, creeper);
public CreeperPowerEvent(final Entity creeper, final Entity bolt, final PowerCause cause) {
this(creeper, cause);
this.bolt = bolt;
this.cause = cause;
}
public CreeperPowerEvent(Entity creeper, PowerCause cause) {
super(Type.CREEPER_POWER, creeper);
public CreeperPowerEvent(final Entity creeper, final PowerCause cause) {
super(creeper);
this.cause = cause;
this.bolt = null;
}
public boolean isCancelled() {

View File

@@ -14,10 +14,10 @@ public class EndermanPickupEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel;
private Block block;
private final Block block;
public EndermanPickupEvent(Entity what, Block block) {
super(Type.ENDERMAN_PICKUP, what);
public EndermanPickupEvent(final Entity what, final Block block) {
super(what);
this.block = block;
this.cancel = false;
}

View File

@@ -16,10 +16,10 @@ public class EndermanPlaceEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel;
private Location location;
private final Location location;
public EndermanPlaceEvent(Entity what, Location location) {
super(Type.ENDERMAN_PLACE, what);
public EndermanPlaceEvent(final Entity what, final Location location) {
super(what);
this.location = location;
this.cancel = false;
}

View File

@@ -14,12 +14,12 @@ import org.bukkit.event.HandlerList;
*/
public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Block block;
private final Block block;
private boolean cancel;
private Material to;
private final Material to;
public EntityChangeBlockEvent(Entity what, Block block, Material to) {
super(Type.ENTITY_CHANGE_BLOCK, what);
public EntityChangeBlockEvent(final Entity what, final Block block, final Material to) {
super(what);
this.block = block;
this.cancel = false;
this.to = to;

View File

@@ -6,9 +6,9 @@ import org.bukkit.entity.Entity;
@SuppressWarnings("serial")
public class EntityCombustByBlockEvent extends EntityCombustEvent {
private Block combuster;
private final Block combuster;
public EntityCombustByBlockEvent(Block combuster, Entity combustee, int duration) {
public EntityCombustByBlockEvent(final Block combuster, final Entity combustee, final int duration) {
super(combustee, duration);
this.combuster = combuster;
}

View File

@@ -5,9 +5,9 @@ import org.bukkit.entity.Entity;
@SuppressWarnings("serial")
public class EntityCombustByEntityEvent extends EntityCombustEvent {
private Entity combuster;
private final Entity combuster;
public EntityCombustByEntityEvent(Entity combuster, Entity combustee, int duration) {
public EntityCombustByEntityEvent(final Entity combuster, final Entity combustee, final int duration) {
super(combustee, duration);
this.combuster = combuster;
}

View File

@@ -15,8 +15,8 @@ public class EntityCombustEvent extends EntityEvent implements Cancellable {
private int duration;
private boolean cancel;
public EntityCombustEvent(Entity combustee, int duration) {
super(Type.ENTITY_COMBUST, combustee);
public EntityCombustEvent(final Entity combustee, final int duration) {
super(combustee);
this.duration = duration;
this.cancel = false;
}

View File

@@ -13,12 +13,12 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial")
public class EntityCreatePortalEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private List<BlockState> blocks;
private final List<BlockState> blocks;
private boolean cancelled = false;
private PortalType type = PortalType.CUSTOM;
public EntityCreatePortalEvent(Entity what, List<BlockState> blocks, PortalType type) {
super(Type.ENTITY_CREATE_PORTAL, what);
public EntityCreatePortalEvent(final Entity what, final List<BlockState> blocks, final PortalType type) {
super(what);
this.blocks = blocks;
this.type = type;

View File

@@ -9,10 +9,10 @@ import org.bukkit.entity.Entity;
@SuppressWarnings("serial")
public class EntityDamageByBlockEvent extends EntityDamageEvent {
private Block damager;
private final Block damager;
public EntityDamageByBlockEvent(Block damager, Entity damagee, DamageCause cause, int damage) {
super(Type.ENTITY_DAMAGE, damagee, cause, damage);
public EntityDamageByBlockEvent(final Block damager, final Entity damagee, final DamageCause cause, final int damage) {
super(damagee, cause, damage);
this.damager = damager;
}

View File

@@ -8,10 +8,10 @@ import org.bukkit.entity.Entity;
@SuppressWarnings("serial")
public class EntityDamageByEntityEvent extends EntityDamageEvent {
private Entity damager;
private final Entity damager;
public EntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, int damage) {
super(Type.ENTITY_DAMAGE, damagee, cause, damage);
public EntityDamageByEntityEvent(final Entity damager, final Entity damagee, final DamageCause cause, final int damage) {
super(damagee, cause, damage);
this.damager = damager;
}

View File

@@ -1,42 +0,0 @@
package org.bukkit.event.entity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Projectile;
/**
* Called when an entity is damaged by a projectile
*
* @deprecated use {@link EntityDamageByEntityEvent} instead, where {@link EntityDamageByEntityEvent#getDamager()} will return the {@link Projectile}
*/
@SuppressWarnings("serial")
@Deprecated
public class EntityDamageByProjectileEvent extends EntityDamageByEntityEvent {
private Projectile projectile;
public EntityDamageByProjectileEvent(Entity damagee, Projectile projectile, DamageCause cause, int damage) {
this(projectile.getShooter(), damagee, projectile, cause, damage);
}
public EntityDamageByProjectileEvent(Entity damager, Entity damagee, Projectile projectile, DamageCause cause, int damage) {
super(damager, projectile, DamageCause.PROJECTILE, damage);
this.projectile = projectile;
}
/**
* The projectile used to cause the event
*
* @return the projectile
*/
public Projectile getProjectile() {
return projectile;
}
public void setBounce(boolean bounce) {
projectile.setBounce(bounce);
}
public boolean getBounce() {
return projectile.doesBounce();
}
}

View File

@@ -3,7 +3,6 @@ package org.bukkit.event.entity;
import org.bukkit.entity.ComplexEntityPart;
import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
@@ -15,14 +14,10 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
private int damage;
private boolean cancelled;
private DamageCause cause;
private final DamageCause cause;
public EntityDamageEvent(Entity damagee, DamageCause cause, int damage) {
this(Event.Type.ENTITY_DAMAGE, damagee, cause, damage);
}
protected EntityDamageEvent(Event.Type type, Entity damagee, DamageCause cause, int damage) {
super(type, damagee);
public EntityDamageEvent(final Entity damagee, final DamageCause cause, final int damage) {
super(damagee);
this.cause = cause;
this.damage = damage;

View File

@@ -11,15 +11,15 @@ import org.bukkit.inventory.ItemStack;
@SuppressWarnings("serial")
public class EntityDeathEvent extends EntityEvent {
private static final HandlerList handlers = new HandlerList();
private List<ItemStack> drops;
private final List<ItemStack> drops;
private int dropExp = 0;
public EntityDeathEvent(final Entity entity, final List<ItemStack> drops) {
this(entity, drops, 0);
}
public EntityDeathEvent(final Entity what, final List<ItemStack> drops, int droppedExp) {
super(Type.ENTITY_DEATH, what);
public EntityDeathEvent(final Entity what, final List<ItemStack> drops, final int droppedExp) {
super(what);
this.drops = drops;
this.dropExp = droppedExp;
}

View File

@@ -10,8 +10,7 @@ import org.bukkit.event.Event;
public abstract class EntityEvent extends Event {
protected Entity entity;
public EntityEvent(final Event.Type type, final Entity what) {
super(type);
public EntityEvent(final Entity what) {
entity = what;
}

View File

@@ -15,17 +15,12 @@ import java.util.List;
public class EntityExplodeEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel;
private Location location;
private List<Block> blocks;
private final Location location;
private final List<Block> blocks;
private float yield;
@Deprecated
public EntityExplodeEvent(Entity what, Location location, List<Block> blocks) {
this(what, location, blocks, 0.3F);
}
public EntityExplodeEvent(Entity what, Location location, List<Block> blocks, float yield) {
super(Type.ENTITY_EXPLODE, what);
public EntityExplodeEvent(final Entity what, final Location location, final List<Block> blocks, final float yield) {
super(what);
this.location = location;
this.blocks = blocks;
this.yield = yield;

View File

@@ -15,8 +15,8 @@ public class EntityInteractEvent extends EntityEvent implements Cancellable {
private boolean cancelled;
public EntityInteractEvent(Entity entity, Block block) {
super(Type.ENTITY_INTERACT, entity);
public EntityInteractEvent(final Entity entity, final Block block) {
super(entity);
this.block = block;
}

View File

@@ -1,187 +0,0 @@
package org.bukkit.event.entity;
import org.bukkit.event.Listener;
import org.bukkit.event.painting.PaintingPlaceEvent;
import org.bukkit.event.painting.PaintingBreakEvent;
/**
* Handles all events fired in relation to entities
*/
@Deprecated
public class EntityListener implements Listener {
public EntityListener() {}
/**
* Called when a creature is spawned into a world.
* <p />
* If a Creature Spawn event is cancelled, the creature will not spawn.
*
* @param event Relevant event details
*/
public void onCreatureSpawn(CreatureSpawnEvent event) {}
/**
* Called when an item is spawned into a world
*
* @param event Relevant event details
*/
public void onItemSpawn(ItemSpawnEvent event) {}
/**
* Called when an entity combusts.
* <p />
* If an Entity Combust event is cancelled, the entity will not combust.
*
* @param event Relevant event details
*/
public void onEntityCombust(EntityCombustEvent event) {}
/**
* Called when an entity is damaged
*
* @param event Relevant event details
*/
public void onEntityDamage(EntityDamageEvent event) {}
/**
* Called when an entity explodes
*
* @param event Relevant event details
*/
public void onEntityExplode(EntityExplodeEvent event) {}
/**
* Called when an entity's fuse is lit
*
* @param event Relevant event details
*/
public void onExplosionPrime(ExplosionPrimeEvent event) {}
/**
* Called when an entity dies
*
* @param event Relevant event details
*/
public void onEntityDeath(EntityDeathEvent event) {}
/**
* Called when a creature targets another entity
*
* @param event Relevant event details
*/
public void onEntityTarget(EntityTargetEvent event) {}
/**
* Called when an entity interacts with an object
*
* @param event Relevant event details
*/
public void onEntityInteract(EntityInteractEvent event) {}
/**
* Called when an entity enters a portal
*
* @param event Relevant event details
*/
public void onEntityPortalEnter(EntityPortalEnterEvent event) {}
/**
* Called when a painting is placed
*
* @param event Relevant event details
*/
public void onPaintingPlace(PaintingPlaceEvent event) {}
/**
* Called when a painting is broken
*
* @param event Relevant event details
*/
public void onPaintingBreak(PaintingBreakEvent event) {}
/**
* Called when a Pig is struck by lightning
*
* @param event Relevant event details
*/
public void onPigZap(PigZapEvent event) {}
/**
* Called when a Creeper is struck by lightning.
* <p />
* If a Creeper Power event is cancelled, the Creeper will not be powered.
*
* @param event Relevant event details
*/
public void onCreeperPower(CreeperPowerEvent event) {}
/**
* Called when an entity is tamed (currently only applies to Wolves)
*
* @param event Relevant event details
*/
public void onEntityTame(EntityTameEvent event) {}
/**
* Called when an entity regains health (currently only applies to Players)
*
* @param event Relevant event details
*/
public void onEntityRegainHealth(EntityRegainHealthEvent event) {}
/**
* Called when a project hits an object
*
* @param event Relevant event details
*/
public void onProjectileHit(ProjectileHitEvent event) {}
/**
* Called when an Enderman picks a block up
*
* @param event Relevant event details
*/
public void onEndermanPickup(EndermanPickupEvent event) {}
/**
* Called when an Enderman places a block
*
* @param event Relevant event details
*/
public void onEndermanPlace(EndermanPlaceEvent event) {}
/**
* Called when a human entity's food level changes
*
* @param event Relevant event details
*/
public void onFoodLevelChange(FoodLevelChangeEvent event) {}
/**
* Called when a LivingEntity shoots a bow firing an arrow
*
* @param event Relevant event details
*/
public void onEntityShootBow(EntityShootBowEvent event) {}
/**
* Called when a Slime splits into smaller Slimes upon death
*
* @param event Relevant event details
*/
public void onSlimeSplit(SlimeSplitEvent event) {}
/**
* Called when an item despawns from a world
*
* @param event Relevant event details
*/
public void onItemDespawn(ItemDespawnEvent event) {}
/**
* Called when an entity creates a portal.
*
* @param event Relevant event details
*/
public void onEntityCreatePortalEvent(EntityCreatePortalEvent event) {}
}

View File

@@ -11,10 +11,10 @@ import org.bukkit.event.HandlerList;
public class EntityPortalEnterEvent extends EntityEvent {
private static final HandlerList handlers = new HandlerList();
private Location location;
private final Location location;
public EntityPortalEnterEvent(Entity entity, Location location) {
super(Type.ENTITY_PORTAL_ENTER, entity);
public EntityPortalEnterEvent(final Entity entity, final Location location) {
super(entity);
this.location = location;
}

View File

@@ -2,7 +2,6 @@ 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;
/**
@@ -14,10 +13,10 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
private boolean cancelled;
private int amount;
private RegainReason regainReason;
private final RegainReason regainReason;
public EntityRegainHealthEvent(Entity entity, int amount, RegainReason regainReason) {
super(Event.Type.ENTITY_REGAIN_HEALTH, entity);
public EntityRegainHealthEvent(final Entity entity, final int amount, final RegainReason regainReason) {
super(entity);
this.amount = amount;
this.regainReason = regainReason;
}

View File

@@ -14,13 +14,13 @@ import org.bukkit.inventory.ItemStack;
public class EntityShootBowEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private ItemStack bow;
private final ItemStack bow;
private Entity projectile;
private float force;
private final float force;
private boolean cancelled;
public EntityShootBowEvent(LivingEntity shooter, ItemStack bow, Projectile projectile, float force) {
super(Type.ENTITY_SHOOT_BOW, shooter);
public EntityShootBowEvent(final LivingEntity shooter, final ItemStack bow, final Projectile projectile, final float force) {
super(shooter);
this.bow = bow;
this.projectile = projectile;
this.force = force;

View File

@@ -12,10 +12,10 @@ import org.bukkit.event.HandlerList;
public class EntityTameEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private AnimalTamer owner;
private final AnimalTamer owner;
public EntityTameEvent(Entity entity, AnimalTamer owner) {
super(Type.ENTITY_TAME, entity);
public EntityTameEvent(final Entity entity, final AnimalTamer owner) {
super(entity);
this.owner = owner;
}

View File

@@ -12,10 +12,10 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel;
private Entity target;
private TargetReason reason;
private final TargetReason reason;
public EntityTargetEvent(Entity entity, Entity target, TargetReason reason) {
super(Type.ENTITY_TARGET, entity);
public EntityTargetEvent(final Entity entity, final Entity target, final TargetReason reason) {
super(entity);
this.target = target;
this.cancel = false;
this.reason = reason;

View File

@@ -15,14 +15,14 @@ public class ExplosionPrimeEvent extends EntityEvent implements Cancellable {
private float radius;
private boolean fire;
public ExplosionPrimeEvent(Entity what, float radius, boolean fire) {
super(Type.EXPLOSION_PRIME, what);
public ExplosionPrimeEvent(final Entity what, final float radius, final boolean fire) {
super(what);
this.cancel = false;
this.radius = radius;
this.fire = fire;
}
public ExplosionPrimeEvent(Explosive explosive) {
public ExplosionPrimeEvent(final Explosive explosive) {
this(explosive, explosive.getYield(), explosive.isIncendiary());
}

View File

@@ -13,8 +13,8 @@ public class FoodLevelChangeEvent extends EntityEvent implements Cancellable {
private boolean cancel = false;
private int level;
public FoodLevelChangeEvent(Entity what, int level) {
super(Type.FOOD_LEVEL_CHANGE, what);
public FoodLevelChangeEvent(final Entity what, final int level) {
super(what);
this.level = level;
}

View File

@@ -9,10 +9,10 @@ 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;
private final Location location;
public ItemDespawnEvent(Entity spawnee, Location loc) {
super(Type.ITEM_DESPAWN, spawnee);
public ItemDespawnEvent(final Entity spawnee, final Location loc) {
super(spawnee);
location = loc;
}

View File

@@ -12,11 +12,11 @@ import org.bukkit.event.HandlerList;
public class ItemSpawnEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private Location location;
private final Location location;
private boolean canceled;
public ItemSpawnEvent(Entity spawnee, Location loc) {
super(Type.ITEM_SPAWN, spawnee);
public ItemSpawnEvent(final Entity spawnee, final Location loc) {
super(spawnee);
this.location = loc;
}

View File

@@ -12,11 +12,11 @@ public class PigZapEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean canceled;
private Entity pigzombie;
private Entity bolt;
private final Entity pigzombie;
private final Entity bolt;
public PigZapEvent(Entity pig, Entity bolt, Entity pigzombie) {
super(Type.PIG_ZAP, pig);
public PigZapEvent(final Entity pig, final Entity bolt, final Entity pigzombie) {
super(pig);
this.bolt = bolt;
this.pigzombie = pigzombie;
}

View File

@@ -16,15 +16,15 @@ public class PlayerDeathEvent extends EntityDeathEvent {
private int newTotalExp = 0;
private boolean keepLevel = false;
public PlayerDeathEvent(Player player, List<ItemStack> drops, int droppedExp, String deathMessage) {
public PlayerDeathEvent(final Player player, final List<ItemStack> drops, final int droppedExp, final String deathMessage) {
this(player, drops, droppedExp, 0, deathMessage);
}
public PlayerDeathEvent(Player player, List<ItemStack> drops, int droppedExp, int newExp, String deathMessage) {
public PlayerDeathEvent(final Player player, final List<ItemStack> drops, final int droppedExp, final int newExp, final String deathMessage) {
this(player, drops, droppedExp, newExp, 0, 0, deathMessage);
}
public PlayerDeathEvent(Player player, List<ItemStack> drops, int droppedExp, int newExp, int newTotalExp, int newLevel, String deathMessage) {
public PlayerDeathEvent(final Player player, final List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, final String deathMessage) {
super(player, drops, droppedExp);
this.newExp = newExp;
this.newTotalExp = newTotalExp;

View File

@@ -17,10 +17,10 @@ import org.bukkit.event.HandlerList;
public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private Map<LivingEntity, Double> affectedEntities;
private final Map<LivingEntity, Double> affectedEntities;
public PotionSplashEvent(ThrownPotion potion, Map<LivingEntity, Double> affectedEntities) {
super(Type.POTION_SPLASH, potion);
public PotionSplashEvent(final ThrownPotion potion, final Map<LivingEntity, Double> affectedEntities) {
super(potion);
this.affectedEntities = affectedEntities;
}

View File

@@ -10,12 +10,8 @@ import org.bukkit.event.HandlerList;
public class ProjectileHitEvent extends EntityEvent {
private static final HandlerList handlers = new HandlerList();
public ProjectileHitEvent(Projectile projectile) {
super(Type.PROJECTILE_HIT, projectile);
}
public ProjectileHitEvent(Type type, Projectile projectile) {
super(type, projectile);
public ProjectileHitEvent(final Projectile projectile) {
super(projectile);
}
@Override

View File

@@ -14,8 +14,8 @@ public class SheepDyeWoolEvent extends EntityEvent implements Cancellable {
private boolean cancel;
private DyeColor color;
public SheepDyeWoolEvent(Entity what, DyeColor color) {
super(Type.SHEEP_DYE_WOOL, what);
public SheepDyeWoolEvent(final Entity what, final DyeColor color) {
super(what);
this.cancel = false;
this.color = color;
}

View File

@@ -12,8 +12,8 @@ public class SheepRegrowWoolEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel;
public SheepRegrowWoolEvent(Entity what) {
super(Type.SHEEP_REGROW_WOOL, what);
public SheepRegrowWoolEvent(final Entity what) {
super(what);
this.cancel = false;
}

View File

@@ -13,8 +13,8 @@ public class SlimeSplitEvent extends EntityEvent implements Cancellable {
private boolean cancel;
private int count;
public SlimeSplitEvent(Entity what, int count) {
super(Type.SLIME_SPLIT, what);
public SlimeSplitEvent(final Entity what, final int count) {
super(what);
this.cancel = false;
this.count = count;
}