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

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,LinearSettings>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    LinearSettings(Set<BuildMode> modes, int maxBlocks, double maxDistance, double reachSurvival, double reachCreative, boolean midairSurvival, boolean midairCreative, boolean useWhitelist)
    Creates an instance of a LinearSettings record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Set<BuildMode>
    The modes enabled in the config.
    The config defaults, used until the server sends the real values.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the maxBlocks record component.
    double
    Returns the value of the maxDistance record component.
    boolean
    midair(net.minecraft.world.entity.player.Player player)
     
    boolean
    Returns the value of the midairCreative record component.
    boolean
    Returns the value of the midairSurvival record component.
    Returns the value of the modes record component.
    static Set<BuildMode>
    EnumSet.copyOf that also works for an empty collection.
     
    double
    reach(net.minecraft.world.entity.player.Player player)
     
    double
    Returns the value of the reachCreative record component.
    double
    Returns the value of the reachSurvival record component.
    final String
    Returns a string representation of this record class.
    boolean
    Returns the value of the useWhitelist record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 a LinearSettings record class.
      Parameters:
      modes - the value for the modes record component
      maxBlocks - the value for the maxBlocks record component
      maxDistance - the value for the maxDistance record component
      reachSurvival - the value for the reachSurvival record component
      reachCreative - the value for the reachCreative record component
      midairSurvival - the value for the midairSurvival record component
      midairCreative - the value for the midairCreative record component
      useWhitelist - the value for the useWhitelist record component
  • Method Details

    • defaults

      public static LinearSettings defaults()
      The config defaults, used until the server sends the real values.
    • of

      public static LinearSettings of(LinearPlayerData data)
    • configModes

      public static Set<BuildMode> configModes()
      The modes enabled in the config. Unknown names are logged and skipped.
    • modeSet

      public static Set<BuildMode> modeSet(Collection<BuildMode> modes)
      EnumSet.copyOf that 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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • modes

      public Set<BuildMode> modes()
      Returns the value of the modes record component.
      Returns:
      the value of the modes record component
    • maxBlocks

      public int maxBlocks()
      Returns the value of the maxBlocks record component.
      Returns:
      the value of the maxBlocks record component
    • maxDistance

      public double maxDistance()
      Returns the value of the maxDistance record component.
      Returns:
      the value of the maxDistance record component
    • reachSurvival

      public double reachSurvival()
      Returns the value of the reachSurvival record component.
      Returns:
      the value of the reachSurvival record component
    • reachCreative

      public double reachCreative()
      Returns the value of the reachCreative record component.
      Returns:
      the value of the reachCreative record component
    • midairSurvival

      public boolean midairSurvival()
      Returns the value of the midairSurvival record component.
      Returns:
      the value of the midairSurvival record component
    • midairCreative

      public boolean midairCreative()
      Returns the value of the midairCreative record component.
      Returns:
      the value of the midairCreative record component
    • useWhitelist

      public boolean useWhitelist()
      Returns the value of the useWhitelist record component.
      Returns:
      the value of the useWhitelist record component