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