Interface BedEnterProblem


@NonExtendable @Experimental public interface BedEnterProblem
Represents a problem that prevents a player from continuing the sleeping process, preventing it from sleeping and from setting its spawn point
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final BedEnterProblem
    Happens when the bed is set to explode.
    static final BedEnterProblem
    Happens when there are monsters in a 16x10x16 box centered on the bed's head and the player is not in creative mode.
    static final BedEnterProblem
    Happens when the bed has blocks one block above it.
    static final BedEnterProblem
    Happens when a player tries to sleep when an invalid state, for example when a player tries to sleep but is already sleeping or is dead.
    static final BedEnterProblem
    Happens when the bed is too far away from the player.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the error message associated with this problem, if any.
  • Field Details

    • TOO_FAR_AWAY

      static final BedEnterProblem TOO_FAR_AWAY
      Happens when the bed is too far away from the player. Makes no explosion and has an error message
      See Also:
    • OBSTRUCTED

      static final BedEnterProblem OBSTRUCTED
      Happens when the bed has blocks one block above it. Makes no explosion and has an error message
      See Also:
    • NOT_SAFE

      static final BedEnterProblem NOT_SAFE
      Happens when there are monsters in a 16x10x16 box centered on the bed's head and the player is not in creative mode. Makes no explosion and has an error message
      See Also:
    • EXPLOSION

      static final BedEnterProblem EXPLOSION
      Happens when the bed is set to explode. This is defined in the environment attributes of the world. This doesn't have a fixed error message, see BedEnterAction.errorMessage()
    • OTHER

      static final BedEnterProblem OTHER
      Happens when a player tries to sleep when an invalid state, for example when a player tries to sleep but is already sleeping or is dead. This doesn't have an error message at all, the interaction is simply discarded
  • Method Details

    • errorMessage

      @Nullable Component errorMessage()
      Returns the error message associated with this problem, if any. This component is sent to the client as an actionbar message when this problem occur
      Returns:
      the error message