Package io.papermc.paper.block.bed
Interface BedEnterAction
An action type that represents the action that will happen after
PlayerBedEnterEvent and that is
happening during PlayerBedFailEnterEvent-
Method Summary
Modifier and TypeMethodDescriptionGets if the player is allowed to save its spawn point in the bed.canSleep()Gets if the player is allowed to sleep in the bed.Returns the default error message to be shown as an actionbar message to the playerproblem()A problem is an issue that prevents the player from sleeping and from saving its spawn point.
-
Method Details
-
canSleep
BedRuleResult canSleep()Gets if the player is allowed to sleep in the bed. This can beBedRuleResult.ALLOWEDat the same time ascanSetSpawn()It is advised to check for
BedEnterProblems first, as if it returns anything butnullthe 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 beBedRuleResult.ALLOWEDat the same time ascanSleep()It is advised to check for
BedEnterProblems first, as if it returns anything butnullthe bed interaction is prevented- Returns:
- whether the player is allowed to save its spawn point
-
problem
@Nullable BedEnterProblem 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, seecanSleep()andcanSetSpawn()for individual successes- Returns:
- any of
BedEnterProblems if one is found, otherwisenull
-
errorMessage
Returns the default error message to be shown as an actionbar message to the player- Returns:
- the error message
-