mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-11-05 09:09:40 +01:00
Add a . to the end of the bukkit version. Might help MCPC
This commit is contained in:
parent
299347d81c
commit
23da447d7b
@ -21,7 +21,7 @@ public class ReflectionManager {
|
|||||||
static {
|
static {
|
||||||
if (getBukkitVersion().startsWith("v1_")) {
|
if (getBukkitVersion().startsWith("v1_")) {
|
||||||
try {
|
try {
|
||||||
int version = Integer.parseInt(getBukkitVersion().split("_")[1]);
|
int version = Integer.parseInt(getBukkitVersion().replace(".", "").split("_")[1]);
|
||||||
if (version == 7) {
|
if (version == 7) {
|
||||||
currentVersion = LibVersion.V1_7;
|
currentVersion = LibVersion.V1_7;
|
||||||
} else {
|
} else {
|
||||||
@ -34,6 +34,8 @@ public class ReflectionManager {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
currentVersion = V1_7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +58,9 @@ public class ReflectionManager {
|
|||||||
private static Field pingField;
|
private static Field pingField;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
if (bukkitVersion.length() > 0) {
|
||||||
|
bukkitVersion += ".";
|
||||||
|
}
|
||||||
for (Method method : getNmsClass("EntityLiving").getDeclaredMethods()) {
|
for (Method method : getNmsClass("EntityLiving").getDeclaredMethods()) {
|
||||||
try {
|
try {
|
||||||
if (method.getReturnType() == float.class && Modifier.isProtected(method.getModifiers())
|
if (method.getReturnType() == float.class && Modifier.isProtected(method.getModifiers())
|
||||||
@ -174,7 +179,7 @@ public class ReflectionManager {
|
|||||||
|
|
||||||
public static Class getCraftClass(String className) {
|
public static Class getCraftClass(String className) {
|
||||||
try {
|
try {
|
||||||
return Class.forName("org.bukkit.craftbukkit." + getBukkitVersion() + "." + className);
|
return Class.forName("org.bukkit.craftbukkit." + getBukkitVersion() + className);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -193,7 +198,7 @@ public class ReflectionManager {
|
|||||||
|
|
||||||
public static String getEnumArt(Art art) {
|
public static String getEnumArt(Art art) {
|
||||||
try {
|
try {
|
||||||
Class craftArt = Class.forName("org.bukkit.craftbukkit." + getBukkitVersion() + ".CraftArt");
|
Class craftArt = Class.forName("org.bukkit.craftbukkit." + getBukkitVersion() + "CraftArt");
|
||||||
Object enumArt = craftArt.getMethod("BukkitToNotch", Art.class).invoke(null, art);
|
Object enumArt = craftArt.getMethod("BukkitToNotch", Art.class).invoke(null, art);
|
||||||
for (Field field : enumArt.getClass().getFields()) {
|
for (Field field : enumArt.getClass().getFields()) {
|
||||||
if (field.getType() == String.class) {
|
if (field.getType() == String.class) {
|
||||||
@ -235,7 +240,7 @@ public class ReflectionManager {
|
|||||||
|
|
||||||
public static Class getNmsClass(String className) {
|
public static Class getNmsClass(String className) {
|
||||||
try {
|
try {
|
||||||
return Class.forName("net.minecraft.server." + getBukkitVersion() + "." + className);
|
return Class.forName("net.minecraft.server." + getBukkitVersion() + className);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user