Package tschipp.linear.data
Record Class LinearSettings
java.lang.Object
java.lang.Record
tschipp.linear.data.LinearSettings
public record LinearSettings(Set<BuildMode> modes, int maxBlocks, double maxDistance, double reachSurvival, double reachCreative, boolean midairSurvival, boolean midairCreative, boolean useWhitelist)
extends Record
The limits for one player: the server config plus their overrides. Also sent to the player, so the
preview matches what the server builds.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, LinearSettings> -
Constructor Summary
ConstructorsConstructorDescriptionLinearSettings(Set<BuildMode> modes, int maxBlocks, double maxDistance, double reachSurvival, double reachCreative, boolean midairSurvival, boolean midairCreative, boolean useWhitelist) Creates an instance of aLinearSettingsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionThe modes enabled in the config.static LinearSettingsdefaults()The config defaults, used until the server sends the real values.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxBlocksrecord component.doubleReturns the value of themaxDistancerecord component.booleanmidair(net.minecraft.world.entity.player.Player player) booleanReturns the value of themidairCreativerecord component.booleanReturns the value of themidairSurvivalrecord component.modes()Returns the value of themodesrecord component.modeSet(Collection<BuildMode> modes) EnumSet.copyOfthat also works for an empty collection.static LinearSettingsof(LinearPlayerData data) doublereach(net.minecraft.world.entity.player.Player player) doubleReturns the value of thereachCreativerecord component.doubleReturns the value of thereachSurvivalrecord component.final StringtoString()Returns a string representation of this record class.booleanReturns the value of theuseWhitelistrecord component.
-
Field Details
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,LinearSettings> STREAM_CODEC
-
-
Constructor Details
-
LinearSettings
public LinearSettings(Set<BuildMode> modes, int maxBlocks, double maxDistance, double reachSurvival, double reachCreative, boolean midairSurvival, boolean midairCreative, boolean useWhitelist) Creates an instance of aLinearSettingsrecord class.- Parameters:
modes- the value for themodesrecord componentmaxBlocks- the value for themaxBlocksrecord componentmaxDistance- the value for themaxDistancerecord componentreachSurvival- the value for thereachSurvivalrecord componentreachCreative- the value for thereachCreativerecord componentmidairSurvival- the value for themidairSurvivalrecord componentmidairCreative- the value for themidairCreativerecord componentuseWhitelist- the value for theuseWhitelistrecord component
-
-
Method Details
-
defaults
The config defaults, used until the server sends the real values. -
of
-
configModes
The modes enabled in the config. Unknown names are logged and skipped. -
modeSet
EnumSet.copyOfthat also works for an empty collection. -
reach
public double reach(net.minecraft.world.entity.player.Player player) -
midair
public boolean midair(net.minecraft.world.entity.player.Player player) -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 '=='. -
modes
Returns the value of themodesrecord component.- Returns:
- the value of the
modesrecord component
-
maxBlocks
public int maxBlocks()Returns the value of themaxBlocksrecord component.- Returns:
- the value of the
maxBlocksrecord component
-
maxDistance
public double maxDistance()Returns the value of themaxDistancerecord component.- Returns:
- the value of the
maxDistancerecord component
-
reachSurvival
public double reachSurvival()Returns the value of thereachSurvivalrecord component.- Returns:
- the value of the
reachSurvivalrecord component
-
reachCreative
public double reachCreative()Returns the value of thereachCreativerecord component.- Returns:
- the value of the
reachCreativerecord component
-
midairSurvival
public boolean midairSurvival()Returns the value of themidairSurvivalrecord component.- Returns:
- the value of the
midairSurvivalrecord component
-
midairCreative
public boolean midairCreative()Returns the value of themidairCreativerecord component.- Returns:
- the value of the
midairCreativerecord component
-
useWhitelist
public boolean useWhitelist()Returns the value of theuseWhitelistrecord component.- Returns:
- the value of the
useWhitelistrecord component
-