Commits
Miles Holder authored and md_5 committed 82af5dc60ea
1 + | package org.bukkit.event.player; |
2 + | |
3 + | import org.bukkit.block.Sign; |
4 + | import org.bukkit.block.sign.Side; |
5 + | import org.bukkit.entity.Player; |
6 + | import org.bukkit.event.Cancellable; |
7 + | import org.bukkit.event.HandlerList; |
8 + | import org.jetbrains.annotations.ApiStatus; |
9 + | import org.jetbrains.annotations.NotNull; |
10 + | |
11 + | /** |
12 + | * This event is fired when a sign is opened by the player. |
13 + | */ |
14 + | Experimental | .
15 + | public class PlayerSignOpenEvent extends PlayerEvent implements Cancellable { |
16 + | |
17 + | private static final HandlerList handlers = new HandlerList(); |
18 + | private final Sign sign; |
19 + | private final Side side; |
20 + | private final Cause cause; |
21 + | private boolean cancelled; |
22 + | |
23 + | public PlayerSignOpenEvent( final Player player, final Sign sign, final Side side, final Cause cause) { |
24 + | super(player); |
25 + | this.sign = sign; |
26 + | this.side = side; |
27 + | this.cause = cause; |
28 + | } |
29 + | |
30 + | /** |
31 + | * Gets the sign that was opened. |
32 + | * |
33 + | * @return opened sign |
34 + | */ |
35 + | |
36 + | public Sign getSign() { |
37 + | return this.sign; |
38 + | } |
39 + | |
40 + | /** |
41 + | * Gets side of the sign opened. |
42 + | * |
43 + | * @return side of sign opened |
44 + | */ |
45 + | |
46 + | public Side getSide() { |
47 + | return this.side; |
48 + | } |
49 + | |
50 + | /** |
51 + | * Gets the cause of the sign open. |
52 + | * |
53 + | * @return sign open cause |
54 + | */ |
55 + | |
56 + | public Cause getCause() { |
57 + | return this.cause; |
58 + | } |
59 + | |
60 + | |
61 + | public boolean isCancelled() { |
62 + | return this.cancelled; |
63 + | } |
64 + | |
65 + | |
66 + | public void setCancelled(boolean cancel) { |
67 + | this.cancelled = cancel; |
68 + | } |
69 + | |
70 + | |
71 + | |
72 + | public HandlerList getHandlers() { |
73 + | return handlers; |
74 + | } |
75 + | |
76 + | |
77 + | public static HandlerList getHandlerList() { |
78 + | return handlers; |
79 + | } |
80 + | |
81 + | Experimental | .
82 + | public enum Cause { |
83 + | |
84 + | /** |
85 + | * Indicate the sign was opened because of an interaction. |
86 + | */ |
87 + | INTERACT, |
88 + | /** |
89 + | * Indicate the sign was opened because the sign was placed. |
90 + | */ |
91 + | PLACE, |
92 + | /** |
93 + | * Indicate the sign was opened because of a plugin. |
94 + | */ |
95 + | PLUGIN, |
96 + | /** |
97 + | * Indicate the sign was opened for an unknown reason. |
98 + | */ |
99 + | UNKNOWN; |
100 + | } |
101 + | } |