fixed entity damage events for latest bukkit

This commit is contained in:
Redecouverte 2011-02-21 23:30:20 +01:00
parent aee81f918e
commit 10c47eff7e
2 changed files with 15 additions and 5 deletions

View File

@ -49,7 +49,7 @@ public WorldGuardEntityListener(WorldGuardPlugin plugin) {
this.plugin = plugin;
}
@Override
public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
Entity defender = event.getEntity();
DamageCause type = event.getCause();
@ -74,7 +74,7 @@ public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
}
}
@Override
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
Entity attacker = event.getDamager();
Entity defender = event.getEntity();
@ -156,7 +156,20 @@ public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) {
}
@Override
public void onEntityDamage(EntityDamageEvent event) {
if (event instanceof EntityDamageByProjectileEvent) {
this.onEntityDamageByProjectile((EntityDamageByProjectileEvent) event);
return;
} else if (event instanceof EntityDamageByEntityEvent) {
this.onEntityDamageByEntity((EntityDamageByEntityEvent) event);
return;
} else if (event instanceof EntityDamageByBlockEvent) {
this.onEntityDamageByBlock((EntityDamageByBlockEvent) event);
return;
}
Entity defender = event.getEntity();
DamageCause type = event.getCause();

View File

@ -202,9 +202,6 @@ private void registerEvents() {
registerEvent(Event.Type.REDSTONE_CHANGE, blockListener, Priority.High);
registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.High);
registerEvent(Event.Type.ENTITY_DAMAGEDBY_PROJECTILE, entityListener, Priority.High);
registerEvent(Event.Type.ENTITY_DAMAGEDBY_BLOCK, entityListener, Priority.High);
registerEvent(Event.Type.ENTITY_DAMAGEDBY_ENTITY, entityListener, Priority.High);
registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Priority.High);
registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.High);