Quark

Quark

143M Downloads

Wrong number of players triggering ImprovedSleeping

Darinth opened this issue ยท 0 comments

commented

Quark jar/version: Quark-r2.4-322.jar
Minecraft version: 1.16.5
Forge Version: 36.2.20

Sleeping is rounding the number of players needed to try down instead of up. This means that if I specify I want 51% of players (because I want > 50% of players in bed) it will often trigger with < 50%.

int reqPlayers = Math.max(1, (int) (percentReq * (double) legitPlayers));
return (legitPlayers > 0 && ((float) sleepingPlayers / (float) reqPlayers) >= 1);

could be change to

		int reqPlayers = Math.max(1, (int) Math.ceil(percentReq * (double) legitPlayers));
		return (legitPlayers > 0 && ((float) sleepingPlayers / (float) reqPlayers) >= 1);

or

		return (legitPlayers > 0 && ((float) sleepingPlayers / legitPlayers+0.0001) >= percentReq);