Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
HangingPlaceEvent.java
1 package org.bukkit.event.hanging;
2 
3 import org.bukkit.block.Block;
5 import org.bukkit.entity.Hanging;
6 import org.bukkit.entity.Player;
9 
10 /**
11  * Triggered when a hanging entity is created in the world
12  */
13 public class HangingPlaceEvent extends HangingEvent implements Cancellable {
14  private static final HandlerList handlers = new HandlerList();
15  private boolean cancelled;
16  private final Player player;
17  private final Block block;
18  private final BlockFace blockFace;
19 
20  public HangingPlaceEvent(final Hanging hanging, final Player player, final Block block, final BlockFace blockFace) {
21  super(hanging);
22  this.player = player;
23  this.block = block;
24  this.blockFace = blockFace;
25  }
26 
27  /**
28  * Returns the player placing the hanging entity
29  *
30  * @return the player placing the hanging entity
31  */
32  public Player getPlayer() {
33  return player;
34  }
35 
36  /**
37  * Returns the block that the hanging entity was placed on
38  *
39  * @return the block that the hanging entity was placed on
40  */
41  public Block getBlock() {
42  return block;
43  }
44 
45  /**
46  * Returns the face of the block that the hanging entity was placed on
47  *
48  * @return the face of the block that the hanging entity was placed on
49  */
51  return blockFace;
52  }
53 
54  public boolean isCancelled() {
55  return cancelled;
56  }
57 
58  public void setCancelled(boolean cancel) {
59  this.cancelled = cancel;
60  }
61 
62  @Override
63  public HandlerList getHandlers() {
64  return handlers;
65  }
66 
67  public static HandlerList getHandlerList() {
68  return handlers;
69  }
70 }