Record Class MCDataVersion

java.lang.Object
java.lang.Record
net.okocraft.box.api.util.MCDataVersion
Record Components:
dataVersion - the data version (Minecraft Wiki: Data version)
All Implemented Interfaces:
Comparable<MCDataVersion>, Version<MCDataVersion>

public record MCDataVersion(int dataVersion) extends Record implements Version<MCDataVersion>
A class to get/compare Minecraft versions based on data version.
  • Field Details

  • Constructor Details

    • MCDataVersion

      public MCDataVersion(int dataVersion)
      Creates an instance of a MCDataVersion record class.
      Parameters:
      dataVersion - the value for the dataVersion record component
  • Method Details

    • of

      @Contract("_ -> new") @NotNull public static @NotNull MCDataVersion of(int dataVersion)
      Creates a MCDataVersion from the specified data version
      Parameters:
      dataVersion - the data version
      Returns:
      a MCDataVersion
    • current

      @Contract("-> new") @NotNull public static @NotNull MCDataVersion current()
      Gets MCDataVersion of the server on which Box is currently running.
      Returns:
      MCDataVersion of the server on which Box is currently running
    • compareTo

      public int compareTo(@NotNull @NotNull MCDataVersion other)
      Specified by:
      compareTo in interface Comparable<MCDataVersion>
    • 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. All components in this record class 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.
    • dataVersion

      public int dataVersion()
      Returns the value of the dataVersion record component.
      Returns:
      the value of the dataVersion record component