Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PlayerBucketEvent.java
1 package org.bukkit.event.player;
2 
3 import org.bukkit.Material;
4 import org.bukkit.block.Block;
6 import org.bukkit.entity.Player;
9 
10 /**
11  * Called when a player interacts with a Bucket
12  */
13 public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellable {
14  private ItemStack itemStack;
15  private boolean cancelled = false;
16  private final Block blockClicked;
17  private final BlockFace blockFace;
18  private final Material bucket;
19 
20  public PlayerBucketEvent(final Player who, final Block blockClicked, final BlockFace blockFace, final Material bucket, final ItemStack itemInHand) {
21  super(who);
22  this.blockClicked = blockClicked;
23  this.blockFace = blockFace;
24  this.itemStack = itemInHand;
25  this.bucket = bucket;
26  }
27 
28  /**
29  * Returns the bucket used in this event
30  *
31  * @return the used bucket
32  */
33  public Material getBucket() {
34  return bucket;
35  }
36 
37  /**
38  * Get the resulting item in hand after the bucket event
39  *
40  * @return Itemstack hold in hand after the event.
41  */
43  return itemStack;
44  }
45 
46  /**
47  * Set the item in hand after the event
48  *
49  * @param itemStack the new held itemstack after the bucket event.
50  */
51  public void setItemStack(ItemStack itemStack) {
52  this.itemStack = itemStack;
53  }
54 
55  /**
56  * Return the block clicked
57  *
58  * @return the blicked block
59  */
61  return blockClicked;
62  }
63 
64  /**
65  * Get the face on the clicked block
66  *
67  * @return the clicked face
68  */
70  return blockFace;
71  }
72 
73  public boolean isCancelled() {
74  return cancelled;
75  }
76 
77  public void setCancelled(boolean cancel) {
78  this.cancelled = cancel;
79  }
80 }