From e41b1f9a545e7243fa00e4bb3ddb625d3f9440ff Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Mon, 27 Aug 2018 08:51:13 -0500 Subject: [PATCH] Fix pre-1.13 startup problem without breaking 1.13.1... --- .../bukkit/helper/v113_1/BukkitVersionHelperSpigot113_1.java | 5 +++++ .../bukkit/helper/v113/BukkitVersionHelperSpigot113.java | 5 +++++ .../java/org/dynmap/bukkit/helper/BukkitVersionHelper.java | 4 +++- .../java/org/dynmap/bukkit/helper/BukkitVersionHelperCB.java | 5 +---- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/bukkit-helper-113-1/src/main/java/org/dynmap/bukkit/helper/v113_1/BukkitVersionHelperSpigot113_1.java b/bukkit-helper-113-1/src/main/java/org/dynmap/bukkit/helper/v113_1/BukkitVersionHelperSpigot113_1.java index d16cd1aa..7ab7fdfa 100644 --- a/bukkit-helper-113-1/src/main/java/org/dynmap/bukkit/helper/v113_1/BukkitVersionHelperSpigot113_1.java +++ b/bukkit-helper-113-1/src/main/java/org/dynmap/bukkit/helper/v113_1/BukkitVersionHelperSpigot113_1.java @@ -47,6 +47,11 @@ public class BukkitVersionHelperSpigot113_1 extends BukkitVersionHelperCB { protected Class datapalettearray; private Field blockid_field; + @Override + protected boolean isBlockIdNeeded() { + return false; + } + public BukkitVersionHelperSpigot113_1() { datapalettearray = getNMSClass("[Lnet.minecraft.server.DataPaletteBlock;"); blockid_field = getPrivateField(craftchunksnapshot, new String[] { "blockids" }, datapalettearray); diff --git a/bukkit-helper-113/src/main/java/org/dynmap/bukkit/helper/v113/BukkitVersionHelperSpigot113.java b/bukkit-helper-113/src/main/java/org/dynmap/bukkit/helper/v113/BukkitVersionHelperSpigot113.java index c2d697ba..06ae3b6a 100644 --- a/bukkit-helper-113/src/main/java/org/dynmap/bukkit/helper/v113/BukkitVersionHelperSpigot113.java +++ b/bukkit-helper-113/src/main/java/org/dynmap/bukkit/helper/v113/BukkitVersionHelperSpigot113.java @@ -46,6 +46,11 @@ public class BukkitVersionHelperSpigot113 extends BukkitVersionHelperCB { protected Class datapalettearray; private Field blockid_field; + @Override + protected boolean isBlockIdNeeded() { + return false; + } + public BukkitVersionHelperSpigot113() { datapalettearray = getNMSClass("[Lnet.minecraft.server.DataPaletteBlock;"); blockid_field = getPrivateField(craftchunksnapshot, new String[] { "blockids" }, datapalettearray); diff --git a/bukkit-helper/src/main/java/org/dynmap/bukkit/helper/BukkitVersionHelper.java b/bukkit-helper/src/main/java/org/dynmap/bukkit/helper/BukkitVersionHelper.java index 1b695835..8db5408f 100644 --- a/bukkit-helper/src/main/java/org/dynmap/bukkit/helper/BukkitVersionHelper.java +++ b/bukkit-helper/src/main/java/org/dynmap/bukkit/helper/BukkitVersionHelper.java @@ -22,7 +22,9 @@ public abstract class BukkitVersionHelper { public static DynmapBlockState[] stateByID; - protected boolean blockidsneeded = true; + protected boolean isBlockIdNeeded() { + return true; + } protected BukkitVersionHelper() { diff --git a/bukkit-helper/src/main/java/org/dynmap/bukkit/helper/BukkitVersionHelperCB.java b/bukkit-helper/src/main/java/org/dynmap/bukkit/helper/BukkitVersionHelperCB.java index 561bff56..37560401 100644 --- a/bukkit-helper/src/main/java/org/dynmap/bukkit/helper/BukkitVersionHelperCB.java +++ b/bukkit-helper/src/main/java/org/dynmap/bukkit/helper/BukkitVersionHelperCB.java @@ -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);