Merge pull request #2692 from pk910/v3.0

spigot 1.15 support
This commit is contained in:
mikeprimm 2019-12-14 22:12:19 -06:00 committed by GitHub
commit 475db4a97c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 80 additions and 69 deletions

View File

@ -47,6 +47,8 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
private Method cw_gethandle;
/** BiomeBase related helpers */
protected Class<?> biomestorage;
protected Field biomestoragebase;
protected Class<?> biomebase;
protected Class<?> biomebasearray;
protected Field biomebaselist;
@ -131,7 +133,12 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
/* CraftChunkSnapshot */
craftchunksnapshot = getOBCClass("org.bukkit.craftbukkit.CraftChunkSnapshot");
biomebasearray = getNMSClass("[Lnet.minecraft.server.BiomeBase;");
ccss_biome = getPrivateField(craftchunksnapshot, new String[] { "biome" }, biomebasearray);
ccss_biome = getPrivateFieldNoFail(craftchunksnapshot, new String[] { "biome" }, biomebasearray);
if(ccss_biome == null) {
biomestorage = getNMSClass("net.minecraft.server.BiomeStorage");
biomestoragebase = getPrivateField(biomestorage, new String[] { "f" }, biomebasearray);
ccss_biome = getPrivateField(craftchunksnapshot, new String[] { "biome" }, biomestorage);
}
/* CraftChunk */
craftchunk = getOBCClass("org.bukkit.craftbukkit.CraftChunk");
cc_gethandle = getMethod(craftchunk, new String[] { "getHandle" }, new Class[0]);
@ -321,7 +328,11 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
* Get list of defined biomebase objects
*/
public Object[] getBiomeBaseList() {
return (Object[]) getFieldValue(biomebase, biomebaselist, new Object[0]);
Object baselist = getFieldValue(biomebase, biomebaselist, new Object[0]);
if(biomestoragebase != null)
baselist = getFieldValue(baselist, biomestoragebase, new Object[0]);
return (Object[])baselist;
}
/** Get temperature from biomebase */
public float getBiomeBaseTemperature(Object bb) {

View File

@ -30,7 +30,7 @@ dependencies {
implementation(project(':bukkit-helper-114-1')) {
transitive = false
}
implementation(project(':bukkit-helper-115')) {
implementation(project(':bukkit-helper-115')) {
transitive = false
}
}
@ -62,7 +62,7 @@ shadowJar {
include(dependency(':bukkit-helper-113-2'))
include(dependency(':bukkit-helper-114'))
include(dependency(':bukkit-helper-114-1'))
include(dependency(':bukkit-helper-115'))
include(dependency(':bukkit-helper-115'))
}
relocate('org.bstats', 'org.dynmap.bstats')
destinationDir = file '../target'

View File

@ -1,65 +1,65 @@
package org.dynmap.bukkit;
import org.bukkit.Bukkit;
import org.dynmap.Log;
import org.dynmap.bukkit.helper.BukkitVersionHelper;
import org.dynmap.bukkit.helper.BukkitVersionHelperCB;
import org.dynmap.bukkit.helper.BukkitVersionHelperGlowstone;
import org.dynmap.bukkit.helper.v113.BukkitVersionHelperSpigot113;
import org.dynmap.bukkit.helper.v113_1.BukkitVersionHelperSpigot113_1;
import org.dynmap.bukkit.helper.v113_2.BukkitVersionHelperSpigot113_2;
import org.dynmap.bukkit.helper.v114.BukkitVersionHelperSpigot114;
import org.dynmap.bukkit.helper.v114_1.BukkitVersionHelperSpigot114_1;
import org.dynmap.bukkit.helper.v115.BukkitVersionHelperSpigot115;
public class Helper {
public static final BukkitVersionHelper getHelper() {
if (BukkitVersionHelper.helper == null) {
String v = Bukkit.getServer().getVersion();
Log.info("version=" + v);
if (v.contains("MCPC")) {
Log.severe("*********************************************************************************");
Log.severe("* MCPC-Plus is no longer supported via the Bukkit version of Dynmap. *");
Log.severe("* Install the appropriate Forge version of Dynmap. *");
Log.severe("* Add the DynmapCBBridge plugin to enable support for Dynmap-compatible plugins *");
Log.severe("*********************************************************************************");
}
else if(v.contains("BukkitForge")) {
Log.severe("*********************************************************************************");
Log.severe("* BukkitForge is not supported via the Bukkit version of Dynmap. *");
Log.severe("* Install the appropriate Forge version of Dynmap. *");
Log.severe("* Add the DynmapCBBridge plugin to enable support for Dynmap-compatible plugins *");
Log.severe("*********************************************************************************");
}
else if(Bukkit.getServer().getClass().getName().contains("GlowServer")) {
Log.info("Loading Glowstone support");
BukkitVersionHelper.helper = new BukkitVersionHelperGlowstone();
}
else if (v.contains("(MC: 1.15)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot115();
}
else if (v.contains("(MC: 1.14.1)") || v.contains("(MC: 1.14.2)") ||
v.contains("(MC: 1.14.3)") || v.contains("(MC: 1.14.4)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114_1();
}
else if (v.contains("(MC: 1.14)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114();
}
else if (v.contains("(MC: 1.13.2)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_2();
}
else if (v.contains("(MC: 1.13.1)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_1();
}
else if (v.contains("(MC: 1.13)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113();
}
else {
BukkitVersionHelper.helper = new BukkitVersionHelperCB();
}
}
return BukkitVersionHelper.helper;
}
}
package org.dynmap.bukkit;
import org.bukkit.Bukkit;
import org.dynmap.Log;
import org.dynmap.bukkit.helper.BukkitVersionHelper;
import org.dynmap.bukkit.helper.BukkitVersionHelperCB;
import org.dynmap.bukkit.helper.BukkitVersionHelperGlowstone;
import org.dynmap.bukkit.helper.v113.BukkitVersionHelperSpigot113;
import org.dynmap.bukkit.helper.v113_1.BukkitVersionHelperSpigot113_1;
import org.dynmap.bukkit.helper.v113_2.BukkitVersionHelperSpigot113_2;
import org.dynmap.bukkit.helper.v114.BukkitVersionHelperSpigot114;
import org.dynmap.bukkit.helper.v114_1.BukkitVersionHelperSpigot114_1;
import org.dynmap.bukkit.helper.v115.BukkitVersionHelperSpigot115;
public class Helper {
public static final BukkitVersionHelper getHelper() {
if (BukkitVersionHelper.helper == null) {
String v = Bukkit.getServer().getVersion();
Log.info("version=" + v);
if (v.contains("MCPC")) {
Log.severe("*********************************************************************************");
Log.severe("* MCPC-Plus is no longer supported via the Bukkit version of Dynmap. *");
Log.severe("* Install the appropriate Forge version of Dynmap. *");
Log.severe("* Add the DynmapCBBridge plugin to enable support for Dynmap-compatible plugins *");
Log.severe("*********************************************************************************");
}
else if(v.contains("BukkitForge")) {
Log.severe("*********************************************************************************");
Log.severe("* BukkitForge is not supported via the Bukkit version of Dynmap. *");
Log.severe("* Install the appropriate Forge version of Dynmap. *");
Log.severe("* Add the DynmapCBBridge plugin to enable support for Dynmap-compatible plugins *");
Log.severe("*********************************************************************************");
}
else if(Bukkit.getServer().getClass().getName().contains("GlowServer")) {
Log.info("Loading Glowstone support");
BukkitVersionHelper.helper = new BukkitVersionHelperGlowstone();
}
else if (v.contains("(MC: 1.15)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot115();
}
else if (v.contains("(MC: 1.14.1)") || v.contains("(MC: 1.14.2)") ||
v.contains("(MC: 1.14.3)") || v.contains("(MC: 1.14.4)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114_1();
}
else if (v.contains("(MC: 1.14)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114();
}
else if (v.contains("(MC: 1.13.2)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_2();
}
else if (v.contains("(MC: 1.13.1)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_1();
}
else if (v.contains("(MC: 1.13)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113();
}
else {
BukkitVersionHelper.helper = new BukkitVersionHelperCB();
}
}
return BukkitVersionHelper.helper;
}
}