Class ProtocolVersionRange
java.lang.Object
com.viaversion.viaversion.api.protocol.version.ProtocolVersionRange
Wrapper class file for
Range to support multiple ranges. This class is used to
compare ProtocolVersion objects.-
Method Summary
Modifier and TypeMethodDescriptionadd(com.google.common.collect.Range<ProtocolVersion> range) Adds a new range to this range.static ProtocolVersionRangeall()Returns a range that contains all versions.booleancontains(ProtocolVersion version) Checks if the given version is included in this range.booleanstatic ProtocolVersionRangefromString(String str) Parses a range from a string.inthashCode()static ProtocolVersionRangeof(com.google.common.collect.Range<ProtocolVersion> range) Returns a range that contains only the given version.static ProtocolVersionRangeof(ProtocolVersion min, ProtocolVersion max) Returns a range that contains only the given version.static ProtocolVersionRangeof(List<com.google.common.collect.Range<ProtocolVersion>> ranges) Returns a range that contains only the given version.toString()
-
Method Details
-
all
Returns a range that contains all versions.- Returns:
- the range
-
of
Returns a range that contains only the given version.- Parameters:
min- the versionmax- the version- Returns:
- the range
-
of
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
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
Checks if the given version is included in this range.- Parameters:
version- the version- Returns:
trueif the version is included
-
toString
-
equals
-
hashCode
public int hashCode() -
fromString
Parses a range from a string.- Parameters:
str- the string- Returns:
- the range
-