Class MinecraftVersion

java.lang.Object
com.fastasyncworldedit.bukkit.util.MinecraftVersion
All Implemented Interfaces:
Comparable<MinecraftVersion>

public class MinecraftVersion extends Object implements Comparable<MinecraftVersion>
Utility class for retrieving and comparing minecraft server versions.
  • Field Details

  • Constructor Details

    • MinecraftVersion

      public MinecraftVersion(int major, int minor, int release)
      Construct a new version with major, minor and release version.
      Parameters:
      major - Major part of the version, only 1 would make sense.
      minor - Minor part, full updates, e.g. Nether & Caves & Cliffs
      release - Release, changes for the server software during a minor update.
    • MinecraftVersion

      public MinecraftVersion(int major, int minor)
      Construct a new version with major and minor version. The release version is set to 0, therefore ignored.
      See Also:
    • MinecraftVersion

      public MinecraftVersion()
      Construct a new version with major, minor and release based on the server version.
  • Method Details

    • getCurrent

      public static MinecraftVersion getCurrent()
      Get the minecraft version that the server is currently running
      Since:
      2.1.0
    • isEqual

      public boolean isEqual(MinecraftVersion other)
      Parameters:
      other - The other version to compare against.
      Returns:
      true if this version is equal to the other version.
    • isEqualOrHigherThan

      public boolean isEqualOrHigherThan(MinecraftVersion other)
      Parameters:
      other - The other version to compare against.
      Returns:
      true if this version is higher or equal compared to the other version.
    • isEqualOrLowerThan

      public boolean isEqualOrLowerThan(MinecraftVersion other)
      Parameters:
      other - The other version to compare against.
      Returns:
      true if this version is lower or equal compared to the other version.
    • isHigherThan

      public boolean isHigherThan(MinecraftVersion other)
      Parameters:
      other - The other version to compare against.
      Returns:
      true if this version is higher than the other version.
    • isLowerThan

      public boolean isLowerThan(MinecraftVersion other)
      Parameters:
      other - The other version to compare against.
      Returns:
      true if this version is lower than to the other version.
    • getMajor

      public int getMajor()
    • getMinor

      public int getMinor()
    • getRelease

      public int getRelease()
    • compareTo

      public int compareTo(@Nonnull MinecraftVersion other)
      Specified by:
      compareTo in interface Comparable<MinecraftVersion>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object