Skip to content

Commit

Permalink
Fix pre-1.13 startup problem without breaking 1.13.1...
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeprimm committed Aug 27, 2018
1 parent 7d72dc4 commit e41b1f9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public abstract class BukkitVersionHelper {

public static DynmapBlockState[] stateByID;

protected boolean blockidsneeded = true;
protected boolean isBlockIdNeeded() {
return true;
}

protected BukkitVersionHelper() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,11 @@ protected void loadNMS() {
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);

Expand Down

0 comments on commit e41b1f9

Please sign in to comment.