Commits

Parker Hawke authored and md_5 committed deb28d9fe88
#837: Add more bell API
No tags

src/main/java/org/bukkit/block/Bell.java

Modified
1 1 package org.bukkit.block;
2 2
3 +import org.bukkit.entity.Entity;
4 +import org.bukkit.event.block.BellRingEvent;
5 +import org.jetbrains.annotations.Nullable;
6 +
3 7 /**
4 8 * Represents a captured state of Bell.
5 9 */
6 -public interface Bell extends TileState { }
10 +public interface Bell extends TileState {
11 +
12 + /**
13 + * Ring this bell. This will call a {@link BellRingEvent}.
14 + *
15 + * @param entity the entity ringing the bell
16 + * @param direction the direction from which the bell was rung or null to
17 + * ring in the direction that the bell is facing
18 + * @return true if rung successfully, false if the event was cancelled
19 + */
20 + public boolean ring(@Nullable Entity entity, @Nullable BlockFace direction);
21 +
22 + /**
23 + * Ring this bell in the direction that the bell is facing. This will call a
24 + * {@link BellRingEvent}.
25 + *
26 + * @param entity the entity ringing the bell
27 + * @return true if rung successfully, false if the event was cancelled
28 + */
29 + public boolean ring(@Nullable Entity entity);
30 +
31 + /**
32 + * Ring this bell. This will call a {@link BellRingEvent}.
33 + *
34 + * @param direction the direction from which the bell was rung or null to
35 + * ring in the direction that the bell is facing
36 + * @return true if rung successfully, false if the event was cancelled
37 + */
38 + public boolean ring(@Nullable BlockFace direction);
39 +
40 + /**
41 + * Ring this bell in the direction that the bell is facing. This will call a
42 + * {@link BellRingEvent}.
43 + *
44 + * @return true if rung successfully, false if the event was cancelled
45 + */
46 + public boolean ring();
47 +
48 + /**
49 + * Check whether or not this bell is shaking. A bell is considered to be
50 + * shaking if it was recently rung.
51 + * <p>
52 + * A bell will typically shake for 50 ticks.
53 + *
54 + * @return true if shaking, false otherwise
55 + */
56 + public boolean isShaking();
57 +
58 + /**
59 + * Get the amount of ticks since this bell has been shaking, or 0 if the
60 + * bell is not currently shaking.
61 + * <p>
62 + * A bell will typically shake for 50 ticks.
63 + *
64 + * @return the time in ticks since the bell was rung, or 0 if not shaking
65 + */
66 + public int getShakingTicks();
67 +
68 + /**
69 + * Check whether or not this bell is resonating. A bell is considered to be
70 + * resonating if {@link #isShaking() while shaking}, raiders were detected
71 + * in the area and are ready to be highlighted to nearby players.
72 + * <p>
73 + * A bell will typically resonate for 40 ticks.
74 + *
75 + * @return true if resonating, false otherwise
76 + */
77 + public boolean isResonating();
78 +
79 + /**
80 + * Get the amount of ticks since this bell has been resonating, or 0 if the
81 + * bell is not currently resonating.
82 + * <p>
83 + * A bell will typically resonate for 40 ticks.
84 + *
85 + * @return the time in ticks since the bell has been resonating, or 0 if not
86 + * resonating
87 + */
88 + public int getResonatingTicks();
89 +}

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut