mrgeneralq / sleep-most

Control the amount of percentage of sleeping players required to make it day. 100K+ downloads on spigot!
https://www.spigotmc.org/resources/sleep-most-1-14-4-configurable-messages-and-percentage.60623/
30 stars 12 forks source link

Improve dynamic nightcycle animation speed calculation #190

Closed YourMJK closed 1 month ago

YourMJK commented 4 months ago

This changes two things:

Example

nightcycle-animation-speed: 85 players-required: 2

Sleeping additionalPlayersRatio calculatedSpeed
2/5 0.00 85
3/5 0.33 113
4/5 0.66 142
5/5 1.00 170

This new calculation has the nice side effect that enabling dynamic-animation-speed doesn't change anything, as long as only the minimum required number of players are sleeping. In particular, when only one players is on the server and sleeping, the speed also stays at the minimum value.

Another possible improvement would be to make the factor for the maximum value configurable by the user, of course.

mrgeneralq commented 1 month ago

Hello @YourMJK

Thank you for this. I will include this as part of the release.

Kind regards

Quinten