Fix pre-1.13 startup problem without breaking 1.13.1...

This commit is contained in:
Mike Primm 2018-08-27 08:51:13 -05:00
parent 7d72dc4bbd
commit e41b1f9a54
4 changed files with 14 additions and 5 deletions

View file

@ -22,7 +22,9 @@ public abstract class BukkitVersionHelper {
public static DynmapBlockState[] stateByID;
protected boolean blockidsneeded = true;
protected boolean isBlockIdNeeded() {
return true;
}
protected BukkitVersionHelper() {

View file

@ -69,14 +69,11 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
nmsblock = getNMSClass("net.minecraft.server.Block");
nmsblockarray = getNMSClass("[Lnet.minecraft.server.Block;");
nmsmaterial = getNMSClass("net.minecraft.server.Material");
Log.info("blockidsneeded=" + blockidsneeded);
if (blockidsneeded) { // Not needed for 1.13+
if (isBlockIdNeeded()) { // Not needed for 1.13+
blockbyid = getFieldNoFail(nmsblock, new String[] { "byId" }, nmsblockarray);
if (blockbyid == null) {
blockbyidfunc = getMethod(nmsblock, new String[] { "getById", "e" }, new Class[] { int.class });
Log.info("blockbyidfunc found = " + (blockbyidfunc != null));
}
Log.info("blockbyid found = " + (blockbyid != null));
}
material = getPrivateField(nmsblock, new String[] { "material" }, nmsmaterial);