mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
Shifting damage events per http://forums.bukkit.org/threads/oops-i-broke-your-plugins.599/#post-67424 (This breaks stuff!)
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
ffe5fb2dfb
commit
a36de75a17
6 changed files with 3 additions and 49 deletions
|
@ -483,28 +483,6 @@ public abstract class Event {
|
|||
*/
|
||||
CREATURE_SPAWN (Category.LIVING_ENTITY),
|
||||
|
||||
/**
|
||||
* Called when a LivingEntity is damaged by the environment (for example,
|
||||
* falling or lava)
|
||||
*
|
||||
* @see org.bukkit.event.entity.EntityDamageByBlockEvent
|
||||
*/
|
||||
ENTITY_DAMAGEDBY_BLOCK (Category.LIVING_ENTITY),
|
||||
|
||||
/**
|
||||
* Called when a LivingEntity is damaged by another LivingEntity
|
||||
*
|
||||
* @see org.bukkit.event.entity.EntityDamageByEntityEvent
|
||||
*/
|
||||
ENTITY_DAMAGEDBY_ENTITY (Category.LIVING_ENTITY),
|
||||
|
||||
/**
|
||||
* Called when a LivingEntity is damaged by a projectile Entity
|
||||
*
|
||||
* @see org.bukkit.event.entity.EntityDamageByProjectileEvent
|
||||
*/
|
||||
ENTITY_DAMAGEDBY_PROJECTILE (Category.LIVING_ENTITY),
|
||||
|
||||
/**
|
||||
* Called when a LivingEntity is damaged with no source.
|
||||
*
|
||||
|
|
|
@ -14,7 +14,7 @@ public class EntityDamageByBlockEvent extends EntityDamageEvent implements Cance
|
|||
|
||||
public EntityDamageByBlockEvent(Block damager, Entity damagee, DamageCause cause, int damage)
|
||||
{
|
||||
super(Event.Type.ENTITY_DAMAGEDBY_BLOCK, damagee, cause, damage);
|
||||
super(Event.Type.ENTITY_DAMAGED, damagee, cause, damage);
|
||||
this.damager = damager;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent implements Canc
|
|||
|
||||
public EntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, int damage)
|
||||
{
|
||||
super(Event.Type.ENTITY_DAMAGEDBY_ENTITY, damagee, cause, damage);
|
||||
super(Event.Type.ENTITY_DAMAGED, damagee, cause, damage);
|
||||
this.damager = damager;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ public class EntityDamageByProjectileEvent extends EntityDamageByEntityEvent {
|
|||
private boolean bounce;
|
||||
|
||||
public EntityDamageByProjectileEvent(Entity damager, Entity damagee, Entity projectile, DamageCause cause, int damage) {
|
||||
super(Event.Type.ENTITY_DAMAGEDBY_PROJECTILE, damager, damagee, cause, damage);
|
||||
super(Event.Type.ENTITY_DAMAGED, damager, damagee, cause, damage);
|
||||
this.projectile = projectile;
|
||||
Random random = new Random();
|
||||
this.bounce = random.nextBoolean();
|
||||
|
|
|
@ -12,15 +12,6 @@ public class EntityListener implements Listener {
|
|||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
}
|
||||
|
||||
public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
|
||||
}
|
||||
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
}
|
||||
|
||||
public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) {
|
||||
}
|
||||
|
||||
public void onEntityCombust(EntityCombustEvent event) {
|
||||
}
|
||||
|
||||
|
|
|
@ -313,21 +313,6 @@ public final class JavaPluginLoader implements PluginLoader {
|
|||
};
|
||||
|
||||
// Entity Events
|
||||
case ENTITY_DAMAGEDBY_BLOCK:
|
||||
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
||||
((EntityListener)listener).onEntityDamageByBlock( (EntityDamageByBlockEvent)event );
|
||||
}
|
||||
};
|
||||
case ENTITY_DAMAGEDBY_ENTITY:
|
||||
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
||||
((EntityListener)listener).onEntityDamageByEntity( (EntityDamageByEntityEvent)event );
|
||||
}
|
||||
};
|
||||
case ENTITY_DAMAGEDBY_PROJECTILE:
|
||||
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
||||
((EntityListener)listener).onEntityDamageByProjectile( (EntityDamageByProjectileEvent)event );
|
||||
}
|
||||
};
|
||||
case ENTITY_DAMAGED:
|
||||
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
||||
((EntityListener)listener).onEntityDamage( (EntityDamageEvent)event );
|
||||
|
|
Loading…
Reference in a new issue