Class ProtocolVersionRange

java.lang.Object
com.viaversion.viaversion.api.protocol.version.ProtocolVersionRange

public class ProtocolVersionRange extends Object
Wrapper class file for Range to support multiple ranges. This class is used to compare ProtocolVersion objects.
  • Method Details

    • all

      public static ProtocolVersionRange all()
      Returns a range that contains all versions.
      Returns:
      the range
    • of

      Returns a range that contains only the given version.
      Parameters:
      min - the version
      max - the version
      Returns:
      the range
    • of

      public static ProtocolVersionRange of(com.google.common.collect.Range<ProtocolVersion> range)
      Returns a range that contains only the given version.
      Parameters:
      range - the version
      Returns:
      the range
    • of

      public static ProtocolVersionRange of(List<com.google.common.collect.Range<ProtocolVersion>> ranges)
      Returns a range that contains only the given version. The list can be immutable.
      Parameters:
      ranges - the version
      Returns:
      the range
    • add

      public ProtocolVersionRange add(com.google.common.collect.Range<ProtocolVersion> range)
      Adds a new range to this range. This method is only available if the range is not already containing all versions.
      Parameters:
      range - the range to add
      Returns:
      this range
    • contains

      public boolean contains(ProtocolVersion version)
      Checks if the given version is included in this range.
      Parameters:
      version - the version
      Returns:
      true if the version is included
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • fromString

      public static ProtocolVersionRange fromString(String str)
      Parses a range from a string.
      Parameters:
      str - the string
      Returns:
      the range