Implementation of the EntityDamage*Events.
A new event EntityDamageByProjectileEvent was created. EntityDamageByProjectileEvent adds the ability to get the projectile entity (such as an egg) and also set if the projectile 'bounces'. New interfaces were created to facilitate all kinds of projectile entities. Changes were made to facilitate the new event, and enable other events, for plugins and event listeners.
This commit is contained in:
committed by
Erik Broes
parent
3b0385334e
commit
696880e64f
@@ -0,0 +1,35 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class EntityDamageByProjectileEvent extends EntityDamageByEntityEvent {
|
||||
|
||||
private Entity projectile;
|
||||
private boolean bounce;
|
||||
|
||||
public EntityDamageByProjectileEvent(Entity damager, Entity damagee, Entity projectile, DamageCause cause, int damage) {
|
||||
super(damager, damagee, cause, damage);
|
||||
this.projectile = projectile;
|
||||
Random random = new Random();
|
||||
this.bounce = random.nextBoolean();
|
||||
}
|
||||
|
||||
/**
|
||||
* The projectile used to cause the event
|
||||
* @return the projectile
|
||||
*/
|
||||
public Entity getProjectile() {
|
||||
return projectile;
|
||||
}
|
||||
|
||||
public void setBounce(boolean bounce){
|
||||
this.bounce = bounce;
|
||||
}
|
||||
|
||||
public boolean getBounce(){
|
||||
return bounce;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user