mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 03:05:28 +01:00
Update for 1.10 - make workaround for Spigot API permanent
This commit is contained in:
parent
95ba9b9521
commit
4300f0b7ab
@ -5,6 +5,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
@ -12,6 +13,7 @@ import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.common.BiomeMap;
|
||||
import org.dynmap.hdmap.HDBlockModels;
|
||||
import org.dynmap.utils.Polygon;
|
||||
|
||||
/**
|
||||
@ -36,7 +38,16 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
|
||||
private boolean isBadUnload = false;
|
||||
|
||||
BukkitVersionHelperCB() {
|
||||
isBadUnload = Bukkit.getServer().getBukkitVersion().contains("1.9");
|
||||
String bukkitver = DynmapPlugin.plugin.getServer().getVersion();
|
||||
String mcver = "1.0.0";
|
||||
int idx = bukkitver.indexOf("(MC: ");
|
||||
if(idx > 0) {
|
||||
mcver = bukkitver.substring(idx+5);
|
||||
idx = mcver.indexOf(")");
|
||||
if(idx > 0) mcver = mcver.substring(0, idx);
|
||||
}
|
||||
isBadUnload = HDBlockModels.checkVersionRange(mcver, "1.9-");
|
||||
Log.verboseinfo("MCVER=" + mcver + ", isBadUnload=" + isBadUnload);
|
||||
}
|
||||
@Override
|
||||
protected String getNMSPackage() {
|
||||
@ -94,18 +105,27 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
|
||||
lhs_containskey = getMethod(longhashset, new String[] { "contains" }, new Class[] { int.class, int.class });
|
||||
}
|
||||
else {
|
||||
longhashset = getOBCClass("org.bukkit.craftbukkit.util.LongHashset");
|
||||
lhs_containskey = getMethod(longhashset, new String[] { "containsKey" }, new Class[] { int.class, int.class });
|
||||
longhashset = getOBCClassNoFail("org.bukkit.craftbukkit.util.LongHashset");
|
||||
if (longhashset != null) {
|
||||
lhs_containskey = getMethod(longhashset, new String[] { "containsKey" }, new Class[] { int.class, int.class });
|
||||
}
|
||||
}
|
||||
|
||||
cps_unloadqueue = getFieldNoFail(chunkprovserver, new String[] { "unloadQueue" }, longhashset);
|
||||
cps_unloadqueue_isSet = false;
|
||||
if (longhashset != null) {
|
||||
cps_unloadqueue = getFieldNoFail(chunkprovserver, new String[] { "unloadQueue" }, longhashset);
|
||||
}
|
||||
if(cps_unloadqueue == null) {
|
||||
cps_unloadqueue = getFieldNoFail(chunkprovserver, new String[] { "unloadQueue" }, Set.class);
|
||||
cps_unloadqueue_isSet = true;
|
||||
}
|
||||
if(cps_unloadqueue == null) {
|
||||
Log.info("Unload queue not found - default to unload all chunks");
|
||||
}
|
||||
/** n.m.s.Chunk */
|
||||
nmschunk = getNMSClass("net.minecraft.server.Chunk");
|
||||
nmsc_tileentities = getField(nmschunk, new String[] { "tileEntities" }, Map.class);
|
||||
nmsc_inhabitedticks = getPrivateFieldNoFail(nmschunk, new String[] { "s", "q", "u", "v" }, long.class);
|
||||
nmsc_inhabitedticks = getPrivateFieldNoFail(nmschunk, new String[] { "s", "q", "u", "v", "w" }, long.class);
|
||||
if (nmsc_inhabitedticks == null) {
|
||||
Log.info("inhabitedTicks field not found - inhabited shader not functional");
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
||||
protected Class<?> longhashset;
|
||||
protected Field nmsw_chunkproviderserver;
|
||||
protected Field cps_unloadqueue;
|
||||
protected boolean cps_unloadqueue_isSet;
|
||||
protected Method lhs_containskey;
|
||||
/** n.m.s.Chunk */
|
||||
protected Class<?> nmschunk;
|
||||
|
Loading…
Reference in New Issue
Block a user