Interface BedEnterAction


@NonExtendable @Experimental public interface BedEnterAction
An action type that represents the action that will happen after PlayerBedEnterEvent and that is happening during PlayerBedFailEnterEvent
  • Method Details

    • canSleep

      BedRuleResult canSleep()
      Gets if the player is allowed to sleep in the bed. This can be BedRuleResult.ALLOWED at the same time as canSetSpawn()

      It is advised to check for BedEnterProblems first, as if it returns anything but null the bed interaction is prevented

      Returns:
      whether the player is allowed to sleep
    • canSetSpawn

      BedRuleResult canSetSpawn()
      Gets if the player is allowed to save its spawn point in the bed. This can be BedRuleResult.ALLOWED at the same time as canSleep()

      It is advised to check for BedEnterProblems first, as if it returns anything but null the bed interaction is prevented

      Returns:
      whether the player is allowed to save its spawn point
    • problem

      A problem is an issue that prevents the player from sleeping and from saving its spawn point. No problem being found doesn't mean the player successfully slept or set its spawn point, see canSleep() and canSetSpawn() for individual successes
      Returns:
      any of BedEnterProblems if one is found, otherwise null
    • errorMessage

      @Nullable Component errorMessage()
      Returns the default error message to be shown as an actionbar message to the player
      Returns:
      the error message