Added a small patch for Libigot.

This commit is contained in:
Kristian S. Stangeland 2013-03-21 02:10:30 +01:00
parent 310fd18e89
commit d643690eef

View File

@ -129,6 +129,9 @@ public class MinecraftReflection {
Class<?> craftClass = craftServer.getClass();
CRAFTBUKKIT_PACKAGE = getPackage(craftClass.getCanonicalName());
// Libigot patch
handleLibigot();
// Next, do the same for CraftEntity.getHandle() in order to get the correct Minecraft package
Class<?> craftEntity = getCraftEntityClass();
Method getHandle = craftEntity.getMethod("getHandle");
@ -165,6 +168,20 @@ public class MinecraftReflection {
throw new IllegalStateException("Could not find Bukkit. Is it running?");
}
}
// Patch for Libigot
private static void handleLibigot() {
try {
getCraftEntityClass();
} catch (RuntimeException e) {
// Try reverting the package to the old format
craftbukkitPackage = null;
CRAFTBUKKIT_PACKAGE = "org.bukkit.craftbukkit";
// This might fail too
getCraftEntityClass();
}
}
/**
* Used during debugging and testing.