Record Class BedRule
java.lang.Object
java.lang.Record
fr.fidorial.world.environment.BedRule
public record BedRule(BedRule.AccessCondition sleepAllowed, BedRule.AccessCondition spawnAllowed, boolean explodes, Optional<Component> failureMessage)
extends Record
Controls whether beds can be used to sleep or set a spawn point in a dimension.
- Since:
- 0.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumControls when a particular bed action is permitted. -
Constructor Summary
ConstructorsConstructorDescriptionBedRule(BedRule.AccessCondition sleepAllowed, BedRule.AccessCondition spawnAllowed, boolean explodes, Optional<Component> failureMessage) Creates an instance of aBedRulerecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic BedRuleAllows beds to only be used to sleep and set a spawn point when its nighttime.static BedRuleallowedAtNight(Component reason) Allows beds to only be used to sleep and set a spawn point when its nighttime.static BedRuleAllows beds to always be used to sleep and set a spawn point.final booleanIndicates whether some other object is "equal to" this one.booleanexplodes()Returns the value of theexplodesrecord component.Returns the value of thefailureMessagerecord component.final inthashCode()Returns a hash code value for this object.static BedRuleForbids beds from ever being used to sleep and set a spawn point.Returns the value of thesleepAllowedrecord component.Returns the value of thespawnAllowedrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
BedRule
public BedRule(BedRule.AccessCondition sleepAllowed, BedRule.AccessCondition spawnAllowed, boolean explodes, Optional<Component> failureMessage) Creates an instance of aBedRulerecord class.- Parameters:
sleepAllowed- the value for thesleepAllowedrecord componentspawnAllowed- the value for thespawnAllowedrecord componentexplodes- the value for theexplodesrecord componentfailureMessage- the value for thefailureMessagerecord component
-
-
Method Details
-
alwaysAllowed
Allows beds to always be used to sleep and set a spawn point.- Returns:
- bed rule
- Since:
- 0.1.0
-
allowedAtNight
Allows beds to only be used to sleep and set a spawn point when its nighttime.- Returns:
- bed rule
- Since:
- 0.1.0
-
allowedAtNight
-
neverAllowed
Forbids beds from ever being used to sleep and set a spawn point.- Returns:
- bed rule
- Since:
- 0.1.0
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
sleepAllowed
Returns the value of thesleepAllowedrecord component.- Returns:
- the value of the
sleepAllowedrecord component
-
spawnAllowed
Returns the value of thespawnAllowedrecord component.- Returns:
- the value of the
spawnAllowedrecord component
-
explodes
public boolean explodes()Returns the value of theexplodesrecord component.- Returns:
- the value of the
explodesrecord component
-
failureMessage
-