My bad.. Didn't know GameProfiles were like this in 1.7

This commit is contained in:
libraryaddict 2014-04-12 17:19:46 +12:00
parent a588e06e46
commit d4d657e53b

View File

@ -16,18 +16,14 @@ import org.bukkit.inventory.ItemStack;
public class ReflectionManager { public class ReflectionManager {
public enum LibVersion { public enum LibVersion {
V1_6, V1_7, V1_7_3; V1_6, V1_7;
private static LibVersion currentVersion; private static LibVersion currentVersion;
static { static {
if (getBukkitVersion().startsWith("v1_")) { if (getBukkitVersion().startsWith("v1_")) {
try { try {
int version = Integer.parseInt(getBukkitVersion().split("_")[1]); int version = Integer.parseInt(getBukkitVersion().split("_")[1]);
if (version == 7) { if (version == 7) {
if (Integer.parseInt(getBukkitVersion().split("_")[1]) < 3) { currentVersion = LibVersion.V1_7;
currentVersion = LibVersion.V1_7;
} else {
currentVersion = LibVersion.V1_7_3;
}
} else { } else {
if (version < 7) { if (version < 7) {
currentVersion = LibVersion.V1_6; currentVersion = LibVersion.V1_6;
@ -50,11 +46,7 @@ public class ReflectionManager {
} }
public static boolean is1_7() { public static boolean is1_7() {
return getGameVersion() == V1_7 || getGameVersion() == V1_7_3; return getGameVersion() == V1_7;
}
public static boolean is1_7_3() {
return getGameVersion() == V1_7_3;
} }
} }
@ -215,7 +207,7 @@ public class ReflectionManager {
} }
public static Object getGameProfile(Player player) { public static Object getGameProfile(Player player) {
if (LibVersion.is1_7_3()) { if (LibVersion.is1_7()) {
try { try {
return getNmsClass("EntityHuman").getMethod("getProfile").invoke(getNmsEntity(player)); return getNmsClass("EntityHuman").getMethod("getProfile").invoke(getNmsEntity(player));
} catch (Exception ex) { } catch (Exception ex) {