Add is1_8 to LibVersion (Uses 1.7 and 1.8 dual build)

This commit is contained in:
libraryaddict 2014-09-27 12:17:43 +12:00
parent 96e7cd181a
commit d399d80a6c

View File

@ -30,7 +30,7 @@ public class ReflectionManager {
public enum LibVersion {
V1_6, V1_7, V1_7_10, V1_7_6, V1_8;
private static LibVersion currentVersion = LibVersion.V1_7;
private static LibVersion currentVersion;
static {
String mcVersion = Bukkit.getVersion().split("MC: ")[1].replace(")", "");
if (mcVersion.startsWith("1.")) {
@ -44,6 +44,12 @@ public class ReflectionManager {
}
}
}
try {
Class.forName("org.spigotmc.ProtocolData");
currentVersion = V1_8;
} catch (Exception ex) {
// Its not 1.8
}
}
public static LibVersion getGameVersion() {
@ -59,12 +65,16 @@ public class ReflectionManager {
}
public static boolean is1_7_10() {
return getGameVersion() == V1_7_10;
return getGameVersion() == V1_7_10 || is1_8();
}
public static boolean is1_7_6() {
return getGameVersion() == V1_7_6 || is1_7_10();
}
public static boolean is1_8() {
return getGameVersion() == V1_8;
}
}
private static final String bukkitVersion = Bukkit.getServer().getClass().getName().split("\\.")[3];
@ -551,7 +561,7 @@ public class ReflectionManager {
}
public static boolean is1_8(Player player) {
if (LibVersion.is1_7_10()) {
if (LibVersion.is1_8()) {
if (is1_8.containsKey(player.getName())) {
return is1_8.get(player.getName());
}