Skip to content

Add World Clock API - #14402

Open
NonSwag wants to merge 5 commits into
mainfrom
feature/world-clock-api
Open

NonSwag wants to merge 5 commits into
mainfrom
feature/world-clock-api

Conversation

@NonSwag

@NonSwag NonSwag commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #14086

Based on main...feature/clock-api

Notes

  • I removed the methods from the Server class from the original branch, because clock managers are now per-world
    When time.affects-all-worlds is enabled, changes apply to the shared global clocks.
  • I did not add a clock version for World#getTime/setTime (time of day) as those assume a 24000 tick day, which not every clock has. (should we deprecate those?)
  • The WorldCreator clock and timeline overrides from the original branch are not included.

Behavior changes

  • /time set <ticks> no longer changes the clokc when its event is cacneled.
  • sleeping now fires ClockTimeSkipEvent instead of TimeSkipEvent when time.affects-all-worlds is enabled.
  • I added equals and hashCode overrides to the vanilla Timeline so that the registry builder round-trip test can compare rebuilt timelines.

TimeSkipEvent extends ClockTimeSKipEvent but has its own HandlerList, so ClockTimeSkipEvent listeners don't receive per-world skips. That was already the case after #13814. Should this be documented or changed?

@NonSwag
NonSwag requested a review from a team as a code owner October 16, 2026 07:45
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Oct 16, 2026

@kennytv kennytv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't need the experimental annotations I'd say

@NonSwag
NonSwag force-pushed the feature/world-clock-api branch from c0b4c49 to b0c8b12 Compare October 21, 2026 07:43
@NonSwag
NonSwag requested a review from Warriorrrr October 21, 2026 07:44
* @param ticks the tick this marker occurs on
* @param showInCommands whether the marker should be suggested in commands
*/
record TimeMarker(@Range(from = 0, to = Integer.MAX_VALUE) int ticks, boolean showInCommands) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no API records, we've been bitten by this before. Make it an interface and add static methods to create one.

@github-project-automation github-project-automation Bot moved this from Awaiting review to Changes required in Paper PR Queue Oct 25, 2026
@NonSwag
NonSwag force-pushed the feature/world-clock-api branch from b0c8b12 to 431b424 Compare October 25, 2026 09:24
@Doc94

Doc94 commented Oct 30, 2026

Copy link
Copy Markdown
Member

Why Range and not NonNegative/Positive?

@NonSwag

NonSwag commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Why Range and not NonNegative/Positive?

Pretty much just personal preference. Most projects I contribute to, have jetbrains' annotations, so kinda my go to.

@Doc94

Doc94 commented Oct 30, 2026

Copy link
Copy Markdown
Member

Pretty much just personal preference. Most projects I contribute to, have jetbrains' annotations, so kinda my go to.

okay i suppose is not a problem but in general we try to use that for that static ranges and the Paper Util for range check later (in implementation with https://github.com/PaperMC/Paper/blob/main/paper-api/src/main/java/io/papermc/paper/util/BoundChecker.java)

@Doc94 Doc94 linked an issue Nov 3, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Changes required

Development

Successfully merging this pull request may close these issues.

World Clock API

5 participants