Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
HorseJumpEvent.java
1 package org.bukkit.event.entity;
2 
3 import org.bukkit.entity.Horse;
6 
7 /**
8  * Called when a horse jumps.
9  */
10 public class HorseJumpEvent extends EntityEvent implements Cancellable {
11  private static final HandlerList handlers = new HandlerList();
12  private boolean cancelled;
13  private float power;
14 
15  public HorseJumpEvent(final Horse horse, final float power) {
16  super(horse);
17  this.power = power;
18  }
19 
20  public boolean isCancelled() {
21  return cancelled;
22  }
23 
24  public void setCancelled(boolean cancel) {
25  cancelled = cancel;
26  }
27 
28  @Override
29  public Horse getEntity() {
30  return (Horse) entity;
31  }
32 
33  /**
34  * Gets the power of the jump.
35  * <p>
36  * Power is a value that defines how much of the horse's jump strength
37  * should be used for the jump. Power is effectively multiplied times
38  * the horse's jump strength to determine how high the jump is; 0
39  * represents no jump strength while 1 represents full jump strength.
40  * Setting power to a value above 1 will use additional jump strength
41  * that the horse does not usually have.
42  * <p>
43  * Power does not affect how high the horse is capable of jumping, only
44  * how much of its jumping capability will be used in this jump. To set
45  * the horse's overall jump strength, see {@link
46  * Horse#setJumpStrength(double)}.
47  *
48  * @return jump strength
49  */
50  public float getPower() {
51  return power;
52  }
53 
54  /**
55  * Sets the power of the jump.
56  * <p>
57  * Jump power can be set to a value above 1.0 which will increase the
58  * strength of this jump above the horse's actual jump strength.
59  * <p>
60  * Setting the jump power to 0 will result in the jump animation still
61  * playing, but the horse not leaving the ground. Only canceling this
62  * event will result in no jump animation at all.
63  *
64  * @param power power of the jump
65  */
66  public void setPower(float power) {
67  this.power = power;
68  }
69 
70  @Override
71  public HandlerList getHandlers() {
72  return handlers;
73  }
74 
75  public static HandlerList getHandlerList() {
76  return handlers;
77  }
78 }