Paper
Paper copied to clipboard
Add Tick TemporalUnit
This PR adds a new class Tick that implements TemporalUnit to allow easy handling of ticks as a unit of time. Additionally, some unit tests have been provided just for fun.
For example, to create a new duration from a certain number of ticks you can simply do one of the following:
Duration.of(50, Tick.tick());
Tick.of(50);
The inverse is also possible, calculating the whole number of ticks in a given duration:
Tick.fromDuration(Duration.of(100, ChronoUnit.SECONDS));
This PR is a more restrictive version of the equivalent PR in Minestom.
isDurationEstimated should return true, the nature of tying this hard to a time seems a bit flawed to me
isDurationEstimated should return true, the nature of tying this hard to a time seems a bit flawed to me
Good point! I've edited the return type and added a note in the javadoc.
EDIT: It's worth noting that markin the duration as estimated prevents the main use of this class existing. Might just be worth closing this and leaving it to maths tbh.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
No!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
The only place for concern has to do with the "isDurationEstimated", as it was mentioned
It's worth noting that markin the duration as estimated prevents the main use of this class existing.
Cause, for example,

Yea, I mean, I really feel iffy on this. Like, the expectation of time is that, it, well, progresses at a steady rate, and, ticks trrrrrrry to but technically kinda don't. I guess the limitation of it not allowing maths from that unit elsewhere is kinda dumb and probably justifies not marking it as as an "estimation", I would probably maybe make a note of that