Class SleepingTimeCheckEvent


  • public class SleepingTimeCheckEvent
    extends PlayerEvent
    This event is fired when the game checks if players can sleep at this time.
    Failing this check will cause sleeping players to wake up and prevent awake players from sleeping.
    This event has a result. Event.HasResult
    setResult(ALLOW) informs game that player can sleep at this time.
    setResult(DEFAULT) causes game to check !World#isDaytime() instead.
    • Field Detail

      • sleepingLocation

        private final java.util.Optional<BlockPos> sleepingLocation
    • Constructor Detail

      • SleepingTimeCheckEvent

        public SleepingTimeCheckEvent​(PlayerEntity player,
                                      java.util.Optional<BlockPos> sleepingLocation)
    • Method Detail

      • getSleepingLocation

        public java.util.Optional<BlockPos> getSleepingLocation()
        Note that the sleeping location may be an approximated one.
        Returns:
        The player's sleeping location.