In a plugin I make use of the method setSleepingIgnored, for players who are AFK. However if this method gets initiated when they are the only ones on the server, it would still reset the time to dawn.
According to the javadoc, at least one player should be sleeping in a bed, however this restriction is no longer in place.
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#setSleepingIgnored-boolean-