package team.unstudio.udpl.util;

/**
 * Bukkit version checker
 */
public enum BukkitVersion{
	V1_12_R1,
	V1_11_R1,
	V1_10_R1,
	V1_9_R2,
	V1_9_R1,
	V1_8_R3,
	V1_8_R2,
	V1_8_R1,
	UNKNOWN;

	/**
	 * if version equal or newer than the version you gave
	 * {@code V1_12_R1.isAbove(V1_8_R1) == true}
	 *
	 * @param value the version to check
	 * @return true if newer or the same
	 */
	public boolean isAbove(BukkitVersion value){
		return compareTo(value) <= 0;
	}


	/**
	 * if version equal or older than the version you gave.
	 * {@code V1_8_R1.isBelow(V1_12_R1) == true}
	 *
	 * @param value the version to check
	 * @return true if older or the same
	 */
	public boolean isBelow(BukkitVersion value){
		return compareTo(value) >= 0;
	}

	/**
	 * get package name like "v1_12_R1"
	 */
	public String getPackageName(){
		return 'v'+(name().substring(1));
	}

	private static BukkitVersion CURRENT_BUKKIT_VERSION;

	/**
	 * get current bukkit version
	 */
	public static BukkitVersion getCurrentBukkitVersion(){
		if(CURRENT_BUKKIT_VERSION == null){
			CURRENT_BUKKIT_VERSION = valueOf(ReflectionUtils.PackageType.getServerVersion().toUpperCase());
			if(CURRENT_BUKKIT_VERSION == null)
				CURRENT_BUKKIT_VERSION = BukkitVersion.UNKNOWN;
		}
		return CURRENT_BUKKIT_VERSION;
	}
}

@@ -94,16 +94,19 @@
 rsion%7B%0D%0A
+%09%0D%0A
 %09V1_12_R
@@ -110,99 +110,576 @@
 2_R1
-,%0D%0A%09V1_11_R1,%0D%0A%09V1_10_R1,%0D%0A%09V1_9_R2,%0D%0A%09V1_9_R1,%0D%0A%09V1_8_R3,%0D%0A%09V1_8_R2,%0D%0A%09V1_8_R1,%0D%0A%09UNKNOWN;
+(%22v1_12_R1%22,%221.12.2%22),%0D%0A%09V1_11_R1(%22v1_11_R1%22,%221.11.2%22),%0D%0A%09V1_10_R1(%22v1_10_R1%22,%221.10.2%22),%0D%0A%09V1_9_R2(%22v1_9_R2%22,%221.9.4%22),%0D%0A%09V1_9_R1(%22v1_9_R1%22,%221.9%22),%0D%0A%09V1_8_R3(%22v1_8_R3%22,%221.8.7%22),%0D%0A%09V1_8_R2(%22v1_8_R2%22,%221.8.3%22),%0D%0A%09V1_8_R1(%22v1_8_R1%22,%221.8%22),%0D%0A%09UNKNOWN(ReflectionUtils.PackageType.getServerVersion(),ServerUtils.getMinecraftVersion());%0D%0A%09%0D%0A%09private final String packetName;%0D%0A%09private final String lastMinecraftVersion;%0D%0A%09%0D%0A%09BukkitVersion(String packetName,String lastMinecraftVersion) %7B%0D%0A%09%09this.packetName = packetName;%0D%0A%09%09this.lastMinecraftVersion = lastMinecraftVersion;%0D%0A%09%7D
 %0D%0A%0D%0A
@@ -1348,33 +1348,100 @@
 urn 
-'v'+(name().substring(1))
+packetName;%0D%0A%09%7D%0D%0A%09%0D%0A%09public String getLastMinecraftVersion()%7B%0D%0A%09%09return lastMinecraftVersion
 ;%0D%0A%09

Update BukkitVersion