11package org .bukkit .event .world ;
22
33import org .bukkit .World ;
4- import org .bukkit .event .Cancellable ;
54import org .bukkit .event .HandlerList ;
65import org .jetbrains .annotations .ApiStatus ;
76import org .jetbrains .annotations .NotNull ;
109 * Called when the time skips in a world.
1110 * <p>
1211 * If the event is cancelled the time will not change.
12+ *
13+ * @see ClockTimeSkipEvent for changing of clocks that affect all worlds
1314 */
14- // TODO - snapshot - 26.1 API needed for clock!
15- public class TimeSkipEvent extends WorldEvent implements Cancellable {
15+ public class TimeSkipEvent extends ClockTimeSkipEvent {
1616
1717 private static final HandlerList HANDLER_LIST = new HandlerList ();
1818
19- private final SkipReason skipReason ;
20- private long skipAmount ;
21-
22- private boolean cancelled ;
19+ private final World world ;
2320
2421 @ ApiStatus .Internal
2522 public TimeSkipEvent (@ NotNull World world , @ NotNull SkipReason skipReason , long skipAmount ) {
26- super (world );
27- this .skipReason = skipReason ;
28- this .skipAmount = skipAmount ;
23+ super (skipReason , skipAmount );
24+ this .world = world ;
2925 }
3026
3127 /**
32- * Gets the reason why the time has skipped.
28+ * Returns the world that time is skipped in .
3329 *
34- * @return a SkipReason value detailing why the time has skipped
30+ * @return world that time is skipped in
3531 */
3632 @ NotNull
37- public SkipReason getSkipReason () {
38- return this .skipReason ;
39- }
40-
41- /**
42- * Gets the amount of time that was skipped.
43- *
44- * @return Amount of time skipped
45- */
46- public long getSkipAmount () {
47- return this .skipAmount ;
48- }
49-
50- /**
51- * Sets the amount of time to skip.
52- *
53- * @param skipAmount Amount of time to skip
54- */
55- public void setSkipAmount (long skipAmount ) {
56- this .skipAmount = skipAmount ;
57- }
58-
59- @ Override
60- public boolean isCancelled () {
61- return this .cancelled ;
62- }
63-
64- @ Override
65- public void setCancelled (boolean cancel ) {
66- this .cancelled = cancel ;
33+ public World getWorld () {
34+ return world ;
6735 }
6836
6937 @ NotNull
@@ -76,24 +44,4 @@ public HandlerList getHandlers() {
7644 public static HandlerList getHandlerList () {
7745 return HANDLER_LIST ;
7846 }
79-
80- /**
81- * An enum specifying the reason the time skipped.
82- */
83- public enum SkipReason {
84-
85- /**
86- * When time is changed using the vanilla /time command.
87- */
88- COMMAND ,
89- /**
90- * When time is changed by a plugin.
91- */
92- CUSTOM ,
93- /**
94- * When time is changed by all players sleeping in their beds and the
95- * night skips.
96- */
97- NIGHT_SKIP
98- }
9947}
0 commit comments