Get gspigot 1.14 runnin

This commit is contained in:
Mike Primm 2019-04-27 18:55:19 -05:00
parent 6f7ccbf7d9
commit e8ec7da47d
5 changed files with 44 additions and 8 deletions

1
bukkit-helper-114/bin/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/main/

View File

@ -53,6 +53,11 @@ public class BukkitVersionHelperSpigot114 extends BukkitVersionHelperCB {
protected boolean isBlockIdNeeded() {
return false;
}
@Override
protected boolean isBiomeBaseListNeeded() {
return false;
}
public BukkitVersionHelperSpigot114() {
datapalettearray = getNMSClass("[Lnet.minecraft.server.DataPaletteBlock;");
@ -94,6 +99,21 @@ public class BukkitVersionHelperSpigot114 extends BukkitVersionHelperCB {
}
return names;
}
/**
* Get list of defined biomebase objects
*/
@Override
public Object[] getBiomeBaseList() {
if (biomelist == null) {
biomelist = new Object[1024];
for (int i = 0; i < 1024; i++) {
biomelist[i] = IRegistry.BIOME.fromId(i);
}
}
return biomelist;
}
/** Get ID from biomebase */
@Override
public int getBiomeBaseID(Object bb) {

View File

@ -25,6 +25,9 @@ public abstract class BukkitVersionHelper {
protected boolean isBlockIdNeeded() {
return true;
}
protected boolean isBiomeBaseListNeeded() {
return true;
}
protected BukkitVersionHelper() {

View File

@ -90,7 +90,7 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
biomebase = getNMSClass("net.minecraft.server.BiomeBase");
biomebasearray = getNMSClass("[Lnet.minecraft.server.BiomeBase;");
biomebaselist = getPrivateFieldNoFail(biomebase, new String[] { "biomes" }, biomebasearray);
if (biomebaselist == null) {
if ((biomebaselist == null) && isBiomeBaseListNeeded()) {
getbiomefunc = getMethodNoFail(biomebase, new String[] { "getBiome" }, new Class[] { int.class, biomebase });
if (getbiomefunc == null) {
getbiomebyid = getMethod(biomebase, new String[] { "a" }, new Class[] { int.class} );
@ -110,7 +110,7 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
else {
biomebasehumifunc = getMethod(biomebase, new String[] { "getHumidity" }, nulltypes);
}
biomebaseidstring = getPrivateField(biomebase, new String[] { "y", "af", "ah", "z", "aS", "aR" }, String.class);
biomebaseidstring = getPrivateField(biomebase, new String[] { "y", "af", "ah", "z", "aS", "aR", "f" }, String.class);
biomebaseid = getFieldNoFail(biomebase, new String[] { "id" }, int.class);
if (biomebaseid == null) {
getidbybiome = getMethod(biomebase, new String[] { "a" }, new Class[] { biomebase } );
@ -165,10 +165,18 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
/** n.m.s.WorldBorder */
nmsworldborder = getNMSClassNoFail("net.minecraft.server.WorldBorder");
if (nmsworldborder != null) {
worldborderminx = getMethod(nmsworldborder, new String[] { "b" }, nulltypes);
worldborderminz = getMethod(nmsworldborder, new String[] { "c" }, nulltypes);
worldbordermaxx = getMethod(nmsworldborder, new String[] { "d" }, nulltypes);
worldbordermaxz = getMethod(nmsworldborder, new String[] { "e" }, nulltypes);
worldbordermaxz = getMethodNoFail(nmsworldborder, new String[] { "f" }, nulltypes);
if (worldbordermaxz == null) {
worldborderminx = getMethod(nmsworldborder, new String[] { "b" }, nulltypes);
worldborderminz = getMethod(nmsworldborder, new String[] { "c" }, nulltypes);
worldbordermaxx = getMethod(nmsworldborder, new String[] { "d" }, nulltypes);
worldbordermaxz = getMethod(nmsworldborder, new String[] { "e" }, nulltypes);
}
else {
worldborderminx = getMethod(nmsworldborder, new String[] { "c" }, nulltypes);
worldborderminz = getMethod(nmsworldborder, new String[] { "d" }, nulltypes);
worldbordermaxx = getMethod(nmsworldborder, new String[] { "e" }, nulltypes);
}
}
/** nbt classes */
@ -334,7 +342,7 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
}
return p;
}
private Object[] biomelist = null;
protected Object[] biomelist = null;
/**
* Get list of defined biomebase objects
*/

View File

@ -252,7 +252,11 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
}
@Override
public String getServerName() {
return getServer().getServerName();
try {
return getServer().getServerName();
} catch (NoSuchMethodError x) { // Missing in 1.14 spigot - no idea why removed...
return getServer().getName();
}
}
@Override
public boolean isPlayerBanned(String pid) {