Open podium868909 opened 17 hours ago
I have to take a look at it, good find though. Wouldn't it be easier to check if the value is 0 or lower and if it is set it to 1 as a failsafe?
removing the players in sleepersneeded i think removes the player count after the gamerule playerssleepingpercentage division so like if there were 2 players and 1 was offline, it would be ceil[ 2/2 - 1 ] = 0 (error!!) which is wrong because it should be ceil[ (2-1)/2 ] = 1 (OK)
sleepersneeded is also i think called many times a second so using update i think which is called less would be more performant i didn't manage to test it much though sorry
Clear. Thanks for the explenation :)
@podium868909 I've created a PR, it adds a check to ssee if the serverPlayer is a instance of OfflinePlayer. If it is, it won't get counted. My main reason for doing it like this is because I don't know what would happen if sleepingPlayers would get upped (++) while the activePlayers would get downed (--). This change would also make sure the number can never be lower than 0 as it doesn't -- at all. What do you think?
Describe the bug the sun will get stuck at sunrise
conditions of bug to occur: a player is in offline mode gamerule sleepingpercentage is set so that only 1 player needs to sleep for the players online on the server currently ignoreSleepingPercentage=true in the config
the modifySleepersNeeded in SleepStatus_sleepersNeededMixin.java line 24: result -= to_ignore; result is set to 1 and to_ignore is also 1 so result will become 0, causing there to be 0 players required to sleep and set it to constantly be sunrise
To Reproduce Steps to reproduce the behavior:
Expected behavior the sun to not be stuck at sunrise
Screenshots If applicable, add screenshots to help explain your problem.
Versions (please complete the following information):
Additional context i did a bit of coding and i think i managed to fix it and tested it a bit but not fully