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 !Level.isDay() instead.
  • Field Details

  • Constructor Details

    • SleepingTimeCheckEvent

      public SleepingTimeCheckEvent(Player player, Optional<BlockPos> sleepingLocation)
  • Method Details

    • getSleepingLocation

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