Commits
Cynthia Yantis authored and md_5 committed 6bff9d09961
1 + | package org.bukkit.event.player; |
2 + | |
3 + | import org.bukkit.Material; |
4 + | import org.bukkit.entity.Fish; |
5 + | import org.bukkit.entity.Player; |
6 + | import org.bukkit.event.Cancellable; |
7 + | import org.bukkit.event.HandlerList; |
8 + | import org.bukkit.inventory.ItemStack; |
9 + | import org.jetbrains.annotations.NotNull; |
10 + | |
11 + | /** |
12 + | * This event is called whenever a player attempts to put a fish in a bucket. |
13 + | */ |
14 + | public class PlayerBucketFishEvent extends PlayerEvent implements Cancellable { |
15 + | |
16 + | private static final HandlerList handlers = new HandlerList(); |
17 + | private boolean cancalled; |
18 + | private final Fish fish; |
19 + | private final ItemStack waterBucket; |
20 + | private final ItemStack fishBucket; |
21 + | |
22 + | public PlayerBucketFishEvent( Player player, Fish fish, ItemStack waterBucket, ItemStack fishBucket) { |
23 + | super(player); |
24 + | this.fish = fish; |
25 + | this.waterBucket = waterBucket; |
26 + | this.fishBucket = fishBucket; |
27 + | } |
28 + | |
29 + | /** |
30 + | * Gets the fish involved with this event. |
31 + | * |
32 + | * @return The fish involved with this event |
33 + | */ |
34 + | |
35 + | public Fish getEntity() { |
36 + | return fish; |
37 + | } |
38 + | |
39 + | /** |
40 + | * Gets the bucket used. |
41 + | * |
42 + | * This refers to the bucket clicked with, ie {@link Material#WATER}. |
43 + | * |
44 + | * @return The used bucket |
45 + | */ |
46 + | |
47 + | public ItemStack getWaterBucket() { |
48 + | return fishBucket; |
49 + | } |
50 + | |
51 + | /** |
52 + | * Gets the bucket that the fish will be put into. |
53 + | * |
54 + | * This refers to the bucket with the fish, ie |
55 + | * {@link Material#PUFFERFISH_BUCKET}. |
56 + | * |
57 + | * @return The bucket that the fish will be put into |
58 + | */ |
59 + | |
60 + | public ItemStack getFishBucket() { |
61 + | return fishBucket; |
62 + | } |
63 + | |
64 + | |
65 + | public boolean isCancelled() { |
66 + | return cancalled; |
67 + | } |
68 + | |
69 + | |
70 + | public void setCancelled(boolean cancel) { |
71 + | this.cancalled = cancel; |
72 + | } |
73 + | |
74 + | |
75 + | |
76 + | public HandlerList getHandlers() { |
77 + | return handlers; |
78 + | } |
79 + | |
80 + | |
81 + | public static HandlerList getHandlerList() { |
82 + | return handlers; |
83 + | } |
84 + | } |