Fix pre-1.13 helper problem (introduced by 1.13.1 support)

This commit is contained in:
Mike Primm 2018-08-27 07:56:16 -05:00
parent 35a74cd0d0
commit fb1026b60f
2 changed files with 5 additions and 1 deletions

View File

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

View File

@ -36,7 +36,6 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
private Method getbiomefunc; private Method getbiomefunc;
private Method getidbybiome; private Method getidbybiome;
private boolean isBadUnload = false; private boolean isBadUnload = false;
protected boolean blockidsneeded = true;
public BukkitVersionHelperCB() { public BukkitVersionHelperCB() {
@ -70,11 +69,14 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
nmsblock = getNMSClass("net.minecraft.server.Block"); nmsblock = getNMSClass("net.minecraft.server.Block");
nmsblockarray = getNMSClass("[Lnet.minecraft.server.Block;"); nmsblockarray = getNMSClass("[Lnet.minecraft.server.Block;");
nmsmaterial = getNMSClass("net.minecraft.server.Material"); nmsmaterial = getNMSClass("net.minecraft.server.Material");
Log.info("blockidsneeded=" + blockidsneeded);
if (blockidsneeded) { // Not needed for 1.13+ if (blockidsneeded) { // Not needed for 1.13+
blockbyid = getFieldNoFail(nmsblock, new String[] { "byId" }, nmsblockarray); blockbyid = getFieldNoFail(nmsblock, new String[] { "byId" }, nmsblockarray);
if (blockbyid == null) { if (blockbyid == null) {
blockbyidfunc = getMethod(nmsblock, new String[] { "getById", "e" }, new Class[] { int.class }); 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); material = getPrivateField(nmsblock, new String[] { "material" }, nmsmaterial);