Class PEVersion

java.lang.Object
com.github.retrooper.packetevents.util.PEVersion

public class PEVersion extends Object
PacketEvents version. This class represents a PacketEvents version.
Since:
1.8
  • Constructor Details

    • PEVersion

      public PEVersion(int... version)
      Specify your version using an array.
      Parameters:
      version - Array version.
    • PEVersion

      public PEVersion(String version)
      Specify your version using a string, for example: "1.8.9".
      Parameters:
      version - String version.
  • Method Details

    • compareTo

      public int compareTo(PEVersion version)
      Compare to another PEVersion. If we are newer than the compared version, this method will return 1. If we are older than the compared version, this method will return -1. If we are equal to the compared version, this method will return 0. Similar to Integer.compareTo(Integer).
      Parameters:
      version - Compared version
      Returns:
      Comparing to another Version.
    • isNewerThan

      public boolean isNewerThan(PEVersion version)
      Does the compareTo(PEVersion) return 1?
      Parameters:
      version - Compared version.
      Returns:
      Is this newer than the compared version.
    • isOlderThan

      public boolean isOlderThan(PEVersion version)
      Does the compareTo(PEVersion) return -1?
      Parameters:
      version - Compared version.
      Returns:
      Is this older than the compared version.
    • asArray

      public int[] asArray()
      Represented as an array.
      Returns:
      Array version.
    • equals

      public boolean equals(Object obj)
      Is this version equal to the compared object. The object must be a PEVersion and the array values must be equal.
      Overrides:
      equals in class Object
      Parameters:
      obj - Compared object.
      Returns:
      Are they equal?
    • clone

      public PEVersion clone()
      Clone the PEVersion.
      Overrides:
      clone in class Object
      Returns:
      A clone.
    • toString

      public String toString()
      Represent the version as a string.
      Overrides:
      toString in class Object
      Returns:
      String representation.