Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
EntityShootBowEvent.java
1 package org.bukkit.event.entity;
2 
3 import org.bukkit.entity.Entity;
9 
10 /**
11  * Called when a LivingEntity shoots a bow firing an arrow
12  */
13 public class EntityShootBowEvent extends EntityEvent implements Cancellable {
14  private static final HandlerList handlers = new HandlerList();
15  private final ItemStack bow;
16  private Entity projectile;
17  private final float force;
18  private boolean cancelled;
19 
20  public EntityShootBowEvent(final LivingEntity shooter, final ItemStack bow, final Projectile projectile, final float force) {
21  super(shooter);
22  this.bow = bow;
23  this.projectile = projectile;
24  this.force = force;
25  }
26 
27  @Override
28  public LivingEntity getEntity() {
29  return (LivingEntity) entity;
30  }
31 
32  /**
33  * Gets the bow ItemStack used to fire the arrow.
34  *
35  * @return the bow involved in this event
36  */
37  public ItemStack getBow() {
38  return bow;
39  }
40 
41  /**
42  * Gets the projectile which will be launched by this event
43  *
44  * @return the launched projectile
45  */
46  public Entity getProjectile() {
47  return projectile;
48  }
49 
50  /**
51  * Replaces the projectile which will be launched
52  *
53  * @param projectile the new projectile
54  */
55  public void setProjectile(Entity projectile) {
56  this.projectile = projectile;
57  }
58 
59  /**
60  * Gets the force the arrow was launched with
61  *
62  * @return bow shooting force, up to 1.0
63  */
64  public float getForce() {
65  return force;
66  }
67 
68  public boolean isCancelled() {
69  return cancelled;
70  }
71 
72  public void setCancelled(boolean cancel) {
73  cancelled = cancel;
74  }
75 
76  @Override
77  public HandlerList getHandlers() {
78  return handlers;
79  }
80 
81  public static HandlerList getHandlerList() {
82  return handlers;
83  }
84 }