Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
HangingBreakEvent.java
1 package org.bukkit.event.hanging;
2 
3 import org.bukkit.entity.Hanging;
6 
7 /**
8  * Triggered when a hanging entity is removed
9  */
10 public class HangingBreakEvent extends HangingEvent implements Cancellable {
11  private static final HandlerList handlers = new HandlerList();
12  private boolean cancelled;
13  private final HangingBreakEvent.RemoveCause cause;
14 
15  public HangingBreakEvent(final Hanging hanging, final HangingBreakEvent.RemoveCause cause) {
16  super(hanging);
17  this.cause = cause;
18  }
19 
20  /**
21  * Gets the cause for the hanging entity's removal
22  *
23  * @return the RemoveCause for the hanging entity's removal
24  */
26  return cause;
27  }
28 
29  public boolean isCancelled() {
30  return cancelled;
31  }
32 
33  public void setCancelled(boolean cancel) {
34  this.cancelled = cancel;
35  }
36 
37  /**
38  * An enum to specify the cause of the removal
39  */
40  public enum RemoveCause {
41  /**
42  * Removed by an entity
43  */
45  /**
46  * Removed by an explosion
47  */
49  /**
50  * Removed by placing a block on it
51  */
53  /**
54  * Removed by destroying the block behind it, etc
55  */
57  /**
58  * Removed by an uncategorised cause
59  */
61  }
62 
63  @Override
64  public HandlerList getHandlers() {
65  return handlers;
66  }
67 
68  public static HandlerList getHandlerList() {
69  return handlers;
70  }
71 }
HangingBreakEvent.RemoveCause getCause()