mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-27 20:58:40 +01:00
Merge commit 'fc717ae7207270056908c0b40024f2f726afc4e4'
This commit is contained in:
commit
d62094e515
12
pom.xml
12
pom.xml
@ -40,8 +40,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.6</source>
|
<source>1.7</source>
|
||||||
<target>1.6</target>
|
<target>1.7</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
@ -114,12 +114,6 @@
|
|||||||
<artifactId>DynmapCore</artifactId>
|
<artifactId>DynmapCore</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.getspout</groupId>
|
|
||||||
<artifactId>spoutpluginapi</artifactId>
|
|
||||||
<version>dev-SNAPSHOT</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ru.tehkode</groupId>
|
<groupId>ru.tehkode</groupId>
|
||||||
<artifactId>PermissionsEx</artifactId>
|
<artifactId>PermissionsEx</artifactId>
|
||||||
@ -141,5 +135,5 @@
|
|||||||
<version>2.10.1</version>
|
<version>2.10.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<version>2.3-SNAPSHOT</version>
|
<version>2.5-SNAPSHOT</version>
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,15 +1,10 @@
|
|||||||
package org.dynmap.bukkit;
|
package org.dynmap.bukkit;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.ChunkSnapshot;
|
import org.bukkit.ChunkSnapshot;
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.dynmap.Log;
|
import org.dynmap.Log;
|
||||||
@ -95,7 +90,7 @@ public abstract class BukkitVersionHelper {
|
|||||||
/**
|
/**
|
||||||
* Get tile entities map from chunk
|
* Get tile entities map from chunk
|
||||||
*/
|
*/
|
||||||
public abstract Map getTileEntitiesForChunk(Chunk c);
|
public abstract Map<?, ?> getTileEntitiesForChunk(Chunk c);
|
||||||
/**
|
/**
|
||||||
* Get X coordinate of tile entity
|
* Get X coordinate of tile entity
|
||||||
*/
|
*/
|
||||||
|
@ -5,13 +5,14 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.dynmap.Log;
|
import org.dynmap.Log;
|
||||||
import org.dynmap.common.BiomeMap;
|
import org.dynmap.hdmap.HDBlockModels;
|
||||||
import org.dynmap.utils.Polygon;
|
import org.dynmap.utils.Polygon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -36,7 +37,16 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
|
|||||||
private boolean isBadUnload = false;
|
private boolean isBadUnload = false;
|
||||||
|
|
||||||
BukkitVersionHelperCB() {
|
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
|
@Override
|
||||||
protected String getNMSPackage() {
|
protected String getNMSPackage() {
|
||||||
@ -83,8 +93,8 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
|
|||||||
chunkprovserver = getNMSClass("net.minecraft.server.ChunkProviderServer");
|
chunkprovserver = getNMSClass("net.minecraft.server.ChunkProviderServer");
|
||||||
nmsw_chunkproviderserver = getPrivateFieldNoFail(nmsworld, new String[] { "chunkProviderServer" }, chunkprovserver);
|
nmsw_chunkproviderserver = getPrivateFieldNoFail(nmsworld, new String[] { "chunkProviderServer" }, chunkprovserver);
|
||||||
if (nmsw_chunkproviderserver == null) {
|
if (nmsw_chunkproviderserver == null) {
|
||||||
Class nmsworldbase = getNMSClass("net.minecraft.server.World");
|
Class<?> nmsworldbase = getNMSClass("net.minecraft.server.World");
|
||||||
Class nmsichunkprovider = getNMSClass("net.minecraft.server.IChunkProvider");
|
Class<?> nmsichunkprovider = getNMSClass("net.minecraft.server.IChunkProvider");
|
||||||
nmsw_chunkproviderserver = getPrivateField(nmsworldbase, new String[] { "chunkProvider" }, nmsichunkprovider);
|
nmsw_chunkproviderserver = getPrivateField(nmsworldbase, new String[] { "chunkProvider" }, nmsichunkprovider);
|
||||||
}
|
}
|
||||||
getworldborder = getMethodNoFail(nmsworld, new String[] { "af" }, nulltypes);
|
getworldborder = getMethodNoFail(nmsworld, new String[] { "af" }, nulltypes);
|
||||||
@ -94,18 +104,27 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
|
|||||||
lhs_containskey = getMethod(longhashset, new String[] { "contains" }, new Class[] { int.class, int.class });
|
lhs_containskey = getMethod(longhashset, new String[] { "contains" }, new Class[] { int.class, int.class });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
longhashset = getOBCClass("org.bukkit.craftbukkit.util.LongHashset");
|
longhashset = getOBCClassNoFail("org.bukkit.craftbukkit.util.LongHashset");
|
||||||
lhs_containskey = getMethod(longhashset, new String[] { "containsKey" }, new Class[] { int.class, int.class });
|
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) {
|
if(cps_unloadqueue == null) {
|
||||||
Log.info("Unload queue not found - default to unload all chunks");
|
Log.info("Unload queue not found - default to unload all chunks");
|
||||||
}
|
}
|
||||||
/** n.m.s.Chunk */
|
/** n.m.s.Chunk */
|
||||||
nmschunk = getNMSClass("net.minecraft.server.Chunk");
|
nmschunk = getNMSClass("net.minecraft.server.Chunk");
|
||||||
nmsc_tileentities = getField(nmschunk, new String[] { "tileEntities" }, Map.class);
|
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) {
|
if (nmsc_inhabitedticks == null) {
|
||||||
Log.info("inhabitedTicks field not found - inhabited shader not functional");
|
Log.info("inhabitedTicks field not found - inhabited shader not functional");
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@ package org.dynmap.bukkit;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@ -24,8 +24,8 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
|||||||
protected String nms_package; // Package used for net.minecraft.server
|
protected String nms_package; // Package used for net.minecraft.server
|
||||||
private boolean failed;
|
private boolean failed;
|
||||||
protected static final Object[] nullargs = new Object[0];
|
protected static final Object[] nullargs = new Object[0];
|
||||||
protected static final Class[] nulltypes = new Class[0];
|
protected static final Class<?>[] nulltypes = new Class[0];
|
||||||
private static final Map nullmap = Collections.emptyMap();
|
private static final Map<?, ?> nullmap = Collections.emptyMap();
|
||||||
|
|
||||||
/** CraftChunkSnapshot */
|
/** CraftChunkSnapshot */
|
||||||
private Class<?> craftchunksnapshot;
|
private Class<?> craftchunksnapshot;
|
||||||
@ -51,6 +51,7 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
|||||||
protected Class<?> longhashset;
|
protected Class<?> longhashset;
|
||||||
protected Field nmsw_chunkproviderserver;
|
protected Field nmsw_chunkproviderserver;
|
||||||
protected Field cps_unloadqueue;
|
protected Field cps_unloadqueue;
|
||||||
|
protected boolean cps_unloadqueue_isSet;
|
||||||
protected Method lhs_containskey;
|
protected Method lhs_containskey;
|
||||||
/** n.m.s.Chunk */
|
/** n.m.s.Chunk */
|
||||||
protected Class<?> nmschunk;
|
protected Class<?> nmschunk;
|
||||||
@ -97,7 +98,6 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
|||||||
|
|
||||||
BukkitVersionHelperGeneric() {
|
BukkitVersionHelperGeneric() {
|
||||||
failed = false;
|
failed = false;
|
||||||
Server srv = Bukkit.getServer();
|
|
||||||
/* Look up base classname for bukkit server - tells us OBC package */
|
/* Look up base classname for bukkit server - tells us OBC package */
|
||||||
obc_package = Bukkit.getServer().getClass().getPackage().getName();
|
obc_package = Bukkit.getServer().getClass().getPackage().getName();
|
||||||
/* Get NMS package */
|
/* Get NMS package */
|
||||||
@ -249,7 +249,7 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
|||||||
/**
|
/**
|
||||||
* Get method
|
* Get method
|
||||||
*/
|
*/
|
||||||
protected Method getMethod(Class<?> cls, String[] ids, Class[] args) {
|
protected Method getMethod(Class<?> cls, String[] ids, Class<?>[] args) {
|
||||||
if(cls == null) return null;
|
if(cls == null) return null;
|
||||||
for(String id : ids) {
|
for(String id : ids) {
|
||||||
try {
|
try {
|
||||||
@ -262,7 +262,7 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
|||||||
failed = true;
|
failed = true;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
protected Method getMethodNoFail(Class<?> cls, String[] ids, Class[] args) {
|
protected Method getMethodNoFail(Class<?> cls, String[] ids, Class<?>[] args) {
|
||||||
if(cls == null) return null;
|
if(cls == null) return null;
|
||||||
for(String id : ids) {
|
for(String id : ids) {
|
||||||
try {
|
try {
|
||||||
@ -327,6 +327,8 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
|||||||
/* For testing unload queue for presence of givne chunk */
|
/* For testing unload queue for presence of givne chunk */
|
||||||
public boolean isInUnloadQueue(Object unloadqueue, int x, int z) {
|
public boolean isInUnloadQueue(Object unloadqueue, int x, int z) {
|
||||||
if(unloadqueue != null) {
|
if(unloadqueue != null) {
|
||||||
|
if (cps_unloadqueue_isSet)
|
||||||
|
return ((Set) unloadqueue).contains(Long.valueOf((long)x & 0xFFFFFFFF | ((long)z & 0xFFFFFFFF) << 32));
|
||||||
return (Boolean)callMethod(unloadqueue, lhs_containskey, new Object[] { x, z }, true);
|
return (Boolean)callMethod(unloadqueue, lhs_containskey, new Object[] { x, z }, true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -358,10 +360,10 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Get tile entities map from chunk */
|
/** Get tile entities map from chunk */
|
||||||
public Map getTileEntitiesForChunk(Chunk c) {
|
public Map<?, ?> getTileEntitiesForChunk(Chunk c) {
|
||||||
Object omsc = callMethod(c, cc_gethandle, nullargs, null);
|
Object omsc = callMethod(c, cc_gethandle, nullargs, null);
|
||||||
if(omsc != null) {
|
if(omsc != null) {
|
||||||
return (Map)getFieldValue(omsc, nmsc_tileentities, nullmap);
|
return (Map<?, ?>)getFieldValue(omsc, nmsc_tileentities, nullmap);
|
||||||
}
|
}
|
||||||
return nullmap;
|
return nullmap;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class BukkitVersionHelperGlowstone extends BukkitVersionHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map getTileEntitiesForChunk(Chunk c) {
|
public Map<?, ?> getTileEntitiesForChunk(Chunk c) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import java.util.List;
|
|||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.permissions.Permission;
|
import org.bukkit.permissions.Permission;
|
||||||
import org.bukkit.permissions.PermissionDefault;
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
import org.dynmap.DynmapChunk;
|
import org.dynmap.DynmapChunk;
|
||||||
|
Loading…
Reference in New Issue
Block a user