Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PigZapEvent.java
1 package org.bukkit.event.entity;
2 
4 import org.bukkit.entity.Pig;
8 
9 /**
10  * Stores data for pigs being zapped
11  */
12 public class PigZapEvent extends EntityEvent implements Cancellable {
13  private static final HandlerList handlers = new HandlerList();
14  private boolean canceled;
15  private final PigZombie pigzombie;
16  private final LightningStrike bolt;
17 
18  public PigZapEvent(final Pig pig, final LightningStrike bolt, final PigZombie pigzombie) {
19  super(pig);
20  this.bolt = bolt;
21  this.pigzombie = pigzombie;
22  }
23 
24  public boolean isCancelled() {
25  return canceled;
26  }
27 
28  public void setCancelled(boolean cancel) {
29  canceled = cancel;
30  }
31 
32  @Override
33  public Pig getEntity() {
34  return (Pig) entity;
35  }
36 
37  /**
38  * Gets the bolt which is striking the pig.
39  *
40  * @return lightning entity
41  */
43  return bolt;
44  }
45 
46  /**
47  * Gets the zombie pig that will replace the pig, provided the event is
48  * not cancelled first.
49  *
50  * @return resulting entity
51  */
53  return pigzombie;
54  }
55 
56  @Override
57  public HandlerList getHandlers() {
58  return handlers;
59  }
60 
61  public static HandlerList getHandlerList() {
62  return handlers;
63  }
64 }
void setCancelled(boolean cancel)