Add is1_8 to LibVersion (Uses 1.7 and 1.8 dual build)
This commit is contained in:
parent
96e7cd181a
commit
d399d80a6c
@ -30,7 +30,7 @@ public class ReflectionManager {
|
|||||||
|
|
||||||
public enum LibVersion {
|
public enum LibVersion {
|
||||||
V1_6, V1_7, V1_7_10, V1_7_6, V1_8;
|
V1_6, V1_7, V1_7_10, V1_7_6, V1_8;
|
||||||
private static LibVersion currentVersion = LibVersion.V1_7;
|
private static LibVersion currentVersion;
|
||||||
static {
|
static {
|
||||||
String mcVersion = Bukkit.getVersion().split("MC: ")[1].replace(")", "");
|
String mcVersion = Bukkit.getVersion().split("MC: ")[1].replace(")", "");
|
||||||
if (mcVersion.startsWith("1.")) {
|
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() {
|
public static LibVersion getGameVersion() {
|
||||||
@ -59,12 +65,16 @@ public class ReflectionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean is1_7_10() {
|
public static boolean is1_7_10() {
|
||||||
return getGameVersion() == V1_7_10;
|
return getGameVersion() == V1_7_10 || is1_8();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean is1_7_6() {
|
public static boolean is1_7_6() {
|
||||||
return getGameVersion() == V1_7_6 || is1_7_10();
|
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];
|
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) {
|
public static boolean is1_8(Player player) {
|
||||||
if (LibVersion.is1_7_10()) {
|
if (LibVersion.is1_8()) {
|
||||||
if (is1_8.containsKey(player.getName())) {
|
if (is1_8.containsKey(player.getName())) {
|
||||||
return is1_8.get(player.getName());
|
return is1_8.get(player.getName());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user