Get 1.13 support building and running a little....

This commit is contained in:
Mike Primm 2018-08-08 01:39:51 -05:00
parent 58d5e59616
commit 654cba2de4
42 changed files with 1763 additions and 249 deletions

2
core/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/target/
/dependency-reduced-pom.xml

177
core/pom.xml Normal file
View File

@ -0,0 +1,177 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>us.dynmap</groupId>
<artifactId>dynmap</artifactId>
<name>dynmap</name>
<url>http://github.com/webbukkit/dynmap/</url>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/webbukkit/dynmap/issues</url>
</issueManagement>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>*.yml</include>
<include>*.txt</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>*.yml</exclude>
<exclude>*.txt</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<artifactSet>
<includes>
<include>org.bstats:*</include>
<include>us.dynmap:dynmap-api:jar:*</include>
<include>us.dynmap:DynmapCore:jar:*</include>
<include>us.dynmap:dynmap-helper:jar:*</include>
<include>us.dynmap:dynmap-helper-113:jar:*</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>org.dynmap</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>dynmap-repo</id>
<url>http://repo.mikeprimm.com/</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>bstats-repo</id>
<url>http://repo.bstats.org/content/repositories/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.nijikokun.bukkit</groupId>
<artifactId>Permissions</artifactId>
<version>3.1.6</version>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-api</artifactId>
<version>3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>DynmapCore</artifactId>
<version>3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ru.tehkode</groupId>
<artifactId>PermissionsEx</artifactId>
<version>1.19.1</version>
</dependency>
<dependency>
<groupId>de.bananaco</groupId>
<artifactId>bPermissions</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>com.platymuus.bukkit.permissions</groupId>
<artifactId>PermissionsBukkit</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.anjocaido</groupId>
<artifactId>EssentialsGroupManager</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-helper</artifactId>
<version>3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-helper-113</artifactId>
<version>3.0-SNAPSHOT</version>
</dependency>
</dependencies>
<version>3.0-SNAPSHOT</version>
<parent>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-bukkit</artifactId>
<version>3.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
</project>

View File

@ -78,6 +78,9 @@ import org.dynmap.Log;
import org.dynmap.MapManager;
import org.dynmap.MapType;
import org.dynmap.PlayerList;
import org.dynmap.bukkit.helper.BukkitVersionHelper;
import org.dynmap.bukkit.helper.BukkitWorld;
import org.dynmap.bukkit.helper.SnapshotCache;
import org.dynmap.bukkit.permissions.BukkitPermissions;
import org.dynmap.bukkit.permissions.NijikokunPermissions;
import org.dynmap.bukkit.permissions.OpPermissions;
@ -102,7 +105,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
private DynmapCore core;
private PermissionProvider permissions;
private String version;
public SnapshotCache sscache;
public PlayerList playerList;
private MapManager mapManager;
public static DynmapPlugin plugin;
@ -370,11 +372,11 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
}
@Override
public double getCacheHitRate() {
return sscache.getHitRate();
return SnapshotCache.sscache.getHitRate();
}
@Override
public void resetCacheStats() {
sscache.resetStats();
SnapshotCache.sscache.resetStats();
}
@Override
public DynmapWorld getWorldByName(String wname) {
@ -769,7 +771,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
public void onLoad() {
Log.setLogger(this.getLogger(), "");
helper = BukkitVersionHelper.getHelper();
helper = Helper.getHelper();
pm = this.getServer().getPluginManager();
ModSupportImpl.init();
@ -885,7 +887,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
return;
}
playerList = core.playerList;
sscache = new SnapshotCache(core.getSnapShotCacheSize(), core.useSoftRefInSnapShotCache());
SnapshotCache.sscache = new SnapshotCache(core.getSnapShotCacheSize(), core.useSoftRefInSnapShotCache());
/* Get map manager from core */
mapManager = core.getMapManager();
@ -919,9 +921,9 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
/* Disable core */
core.disableCore();
if(sscache != null) {
sscache.cleanup();
sscache = null;
if(SnapshotCache.sscache != null) {
SnapshotCache.sscache.cleanup();
SnapshotCache.sscache = null;
}
Log.info("Disabled");
}
@ -974,13 +976,13 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
@Override
public final int triggerRenderOfVolume(String wid, int minx, int miny, int minz,
int maxx, int maxy, int maxz) {
sscache.invalidateSnapshot(wid, minx, miny, minz, maxx, maxy, maxz);
SnapshotCache.sscache.invalidateSnapshot(wid, minx, miny, minz, maxx, maxy, maxz);
return core.triggerRenderOfVolume(wid, minx, miny, minz, maxx, maxy, maxz);
}
@Override
public final int triggerRenderOfBlock(String wid, int x, int y, int z) {
sscache.invalidateSnapshot(wid, x, y, z);
SnapshotCache.sscache.invalidateSnapshot(wid, x, y, z);
return core.triggerRenderOfBlock(wid, x, y, z);
}
@ -1106,7 +1108,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(btt.typeid == 9) btt.typeid = 8;
if((bt != btt.typeid) || (btt.data != w.getBlockAt(loc).getData())) {
String wn = getWorld(w).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
SnapshotCache.sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), btt.trigger);
}
}
@ -1174,7 +1176,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
public void onBlockPlace(BlockPlaceEvent event) {
Location loc = event.getBlock().getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
SnapshotCache.sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockplace");
}
};
@ -1189,7 +1191,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(b == null) return; /* Stupid mod workaround */
Location loc = b.getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
SnapshotCache.sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockbreak");
}
};
@ -1202,7 +1204,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
public void onLeavesDecay(LeavesDecayEvent event) {
Location loc = event.getBlock().getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
SnapshotCache.sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
if(onleaves) {
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "leavesdecay");
}
@ -1217,7 +1219,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
public void onBlockBurn(BlockBurnEvent event) {
Location loc = event.getBlock().getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
SnapshotCache.sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
if(onburn) {
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockburn");
}
@ -1281,14 +1283,14 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
}
String wn = getWorld(loc.getWorld()).getName();
int x = loc.getBlockX(), y = loc.getBlockY(), z = loc.getBlockZ();
sscache.invalidateSnapshot(wn, x, y, z);
SnapshotCache.sscache.invalidateSnapshot(wn, x, y, z);
if(onpiston)
mapManager.touch(wn, x, y, z, "pistonretract");
for(int i = 0; i < 2; i++) {
x += dir.getModX();
y += dir.getModY();
z += dir.getModZ();
sscache.invalidateSnapshot(wn, x, y, z);
SnapshotCache.sscache.invalidateSnapshot(wn, x, y, z);
mapManager.touch(wn, x, y, z, "pistonretract");
}
}
@ -1305,14 +1307,14 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
}
String wn = getWorld(loc.getWorld()).getName();
int x = loc.getBlockX(), y = loc.getBlockY(), z = loc.getBlockZ();
sscache.invalidateSnapshot(wn, x, y, z);
SnapshotCache.sscache.invalidateSnapshot(wn, x, y, z);
if(onpiston)
mapManager.touch(wn, x, y, z, "pistonretract");
for(int i = 0; i < 1+event.getLength(); i++) {
x += dir.getModX();
y += dir.getModY();
z += dir.getModZ();
sscache.invalidateSnapshot(wn, x, y, z);
SnapshotCache.sscache.invalidateSnapshot(wn, x, y, z);
mapManager.touch(wn, x, y, z, "pistonretract");
}
}
@ -1326,7 +1328,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
public void onBlockSpread(BlockSpreadEvent event) {
Location loc = event.getBlock().getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
SnapshotCache.sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockspread");
}
};
@ -1339,7 +1341,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
public void onBlockForm(BlockFormEvent event) {
Location loc = event.getBlock().getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
SnapshotCache.sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockform");
}
};
@ -1352,7 +1354,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
public void onBlockFade(BlockFadeEvent event) {
Location loc = event.getBlock().getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
SnapshotCache.sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockfade");
}
};
@ -1367,7 +1369,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
public void onBlockGrow(BlockGrowEvent event) {
Location loc = event.getBlock().getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
SnapshotCache.sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockgrow");
}
};
@ -1380,7 +1382,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
public void onBlockRedstone(BlockRedstoneEvent event) {
Location loc = event.getBlock().getLocation();
String wn = getWorld(loc.getWorld()).getName();
sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
SnapshotCache.sscache.invalidateSnapshot(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
mapManager.touch(wn, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), "blockredstone");
}
};
@ -1437,7 +1439,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(z < minz) minz = z;
if(z > maxz) maxz = z;
}
sscache.invalidateSnapshot(wname, minx, miny, minz, maxx, maxy, maxz);
SnapshotCache.sscache.invalidateSnapshot(wname, minx, miny, minz, maxx, maxy, maxz);
if(onexplosion) {
mapManager.touchVolume(wname, minx, miny, minz, maxx, maxy, maxz, "entityexplode");
}
@ -1484,7 +1486,7 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
if(z < minz) minz = z;
if(z > maxz) maxz = z;
}
sscache.invalidateSnapshot(wname, minx, miny, minz, maxx, maxy, maxz);
SnapshotCache.sscache.invalidateSnapshot(wname, minx, miny, minz, maxx, maxy, maxz);
if(onstructuregrow) {
mapManager.touchVolume(wname, minx, miny, minz, maxx, maxy, maxz, "structuregrow");
}

View File

@ -0,0 +1,44 @@
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;
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.13)")) {
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113();
}
else {
BukkitVersionHelper.helper = new BukkitVersionHelperCB();
}
}
return BukkitVersionHelper.helper;
}
}

36
helper/.classpath Normal file
View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

1
helper/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target/

23
helper/.project Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>helper</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

47
helper/pom.xml Normal file
View File

@ -0,0 +1,47 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-bukkit</artifactId>
<version>3.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>dynmap-helper</artifactId>
<groupId>us.dynmap</groupId>
<version>3.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-api</artifactId>
<version>3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>DynmapCore</artifactId>
<version>3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>dynmap-repo</id>
<url>http://repo.mikeprimm.com/</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<name>dynmap-helper</name>
</project>

View File

@ -1,54 +1,26 @@
package org.dynmap.bukkit;
package org.dynmap.bukkit.helper;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.ChunkSnapshot;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.dynmap.DynmapChunk;
import org.dynmap.Log;
import org.dynmap.renderer.DynmapBlockState;
import org.dynmap.utils.DynIntHashMap;
import org.dynmap.utils.MapChunkCache;
import org.dynmap.utils.Polygon;
/**
* Helper for isolation of bukkit version specific issues
*/
public abstract class BukkitVersionHelper {
private static BukkitVersionHelper helper = null;
public static BukkitVersionHelper helper = null;
public static final BukkitVersionHelper getHelper() {
if(helper == null) {
Log.info("version=" + Bukkit.getServer().getVersion());
if(Bukkit.getServer().getVersion().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(Bukkit.getServer().getVersion().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");
helper = new BukkitVersionHelperGlowstone();
}
else {
helper = new BukkitVersionHelperCB();
}
}
return helper;
}
public static DynmapBlockState[] stateByID = new DynmapBlockState[65536];
public static DynmapBlockState[] stateByID;
protected BukkitVersionHelper() {
@ -160,6 +132,7 @@ public abstract class BukkitVersionHelper {
public void initializeBlockStates() {
String[] blkname = getBlockNames();
// Keep it simple for now - just assume 16 meta states for each
stateByID = new DynmapBlockState[16*blkname.length];
Arrays.fill(stateByID, DynmapBlockState.AIR);
for (int i = 0; i < blkname.length; i++) {
if (blkname[i] == null) continue;
@ -182,4 +155,18 @@ public abstract class BukkitVersionHelper {
Log.info(gidx + ":" + bs.toString() + ", gidx=" + bs.globalStateIndex + ", sidx=" + bs.stateIndex);
}
}
/**
* Create chunk cache for given chunks of given world
* @param dw - world
* @param chunks - chunk list
* @return cache
*/
public MapChunkCache getChunkCache(BukkitWorld dw, List<DynmapChunk> chunks) {
NewMapChunkCache c = new NewMapChunkCache();
c.setChunks(dw, chunks);
return c;
}
public Object[] getBlockIDFieldFromSnapshot(ChunkSnapshot css) {
return null;
}
}

View File

@ -1,4 +1,4 @@
package org.dynmap.bukkit;
package org.dynmap.bukkit.helper;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@ -13,7 +13,6 @@ import org.bukkit.Server;
import org.bukkit.World;
import org.dynmap.Log;
import org.dynmap.hdmap.HDBlockModels;
import org.dynmap.renderer.DynmapBlockState;
import org.dynmap.utils.Polygon;
/**
@ -24,7 +23,6 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
private Class<?> nmsblockarray;
private Class<?> nmsmaterial;
private Field blockbyid;
private Field blockname;
private Field material;
private Method blockbyidfunc; // 1.7+ method for getting block by id
private Method getworldborder; // 1.8+ method for getting world border
@ -37,8 +35,9 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
private Method getidbybiome;
private boolean isBadUnload = false;
BukkitVersionHelperCB() {
String bukkitver = DynmapPlugin.plugin.getServer().getVersion();
public BukkitVersionHelperCB() {
String bukkitver = Bukkit.getServer().getVersion();
String mcver = "1.0.0";
int idx = bukkitver.indexOf("(MC: ");
if(idx > 0) {
@ -72,7 +71,6 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
if (blockbyid == null) {
blockbyidfunc = getMethod(nmsblock, new String[] { "getById", "e" }, new Class[] { int.class });
}
blockname = getPrivateField(nmsblock, new String[] { "name", "b" }, String.class);
material = getPrivateField(nmsblock, new String[] { "material" }, nmsmaterial);
/* Set up biomebase fields */
@ -87,10 +85,10 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
biomebasehumi = getPrivateField(biomebase, new String[] { "C" }, float.class);
}
else {
biomebasetemp = getPrivateField(biomebase, new String[] { "temperature", "F", "C" }, float.class);
biomebasehumi = getPrivateField(biomebase, new String[] { "humidity", "G", "D" }, float.class);
biomebasetemp = getPrivateField(biomebase, new String[] { "temperature", "F", "C", "aO" }, float.class);
biomebasehumi = getPrivateField(biomebase, new String[] { "humidity", "G", "D", "aP" }, float.class);
}
biomebaseidstring = getPrivateField(biomebase, new String[] { "y", "af", "ah", "z" }, String.class);
biomebaseidstring = getPrivateField(biomebase, new String[] { "y", "af", "ah", "z", "aS" }, String.class);
biomebaseid = getFieldNoFail(biomebase, new String[] { "id" }, int.class);
if (biomebaseid == null) {
getidbybiome = getMethod(biomebase, new String[] { "a" }, new Class[] { biomebase } );
@ -115,6 +113,13 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
if (longhashset != null) {
lhs_containskey = getMethod(longhashset, new String[] { "containsKey" }, new Class[] { int.class, int.class });
}
else {
longhashset = getOBCClassNoFail("org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.longs.LongSet");
if (longhashset != null) {
lhs_containskey = getMethod(longhashset, new String[] { "contains" }, new Class[] { long.class });
cps_unloadqueue_isSet = true;
}
}
}
cps_unloadqueue_isSet = false;
@ -131,7 +136,7 @@ public class BukkitVersionHelperCB extends BukkitVersionHelperGeneric {
/** 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", "w" }, long.class);
nmsc_inhabitedticks = getPrivateFieldNoFail(nmschunk, new String[] { "s", "q", "u", "v", "w", "A" }, long.class);
if (nmsc_inhabitedticks == null) {
Log.info("inhabitedTicks field not found - inhabited shader not functional");
}

View File

@ -1,4 +1,4 @@
package org.dynmap.bukkit;
package org.dynmap.bukkit.helper;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@ -37,7 +37,7 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
private static final Map<?, ?> nullmap = Collections.emptyMap();
/** CraftChunkSnapshot */
private Class<?> craftchunksnapshot;
protected Class<?> craftchunksnapshot;
private Field ccss_biome;
/** CraftChunk */
private Class<?> craftchunk;
@ -114,7 +114,7 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
private Class<?> cma_property;
private Method cmaproperty_getvalue;
BukkitVersionHelperGeneric() {
protected BukkitVersionHelperGeneric() {
failed = false;
/* Look up base classname for bukkit server - tells us OBC package */
obc_package = Bukkit.getServer().getClass().getPackage().getName();

View File

@ -1,4 +1,4 @@
package org.dynmap.bukkit;
package org.dynmap.bukkit.helper;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

View File

@ -1,4 +1,4 @@
package org.dynmap.bukkit;
package org.dynmap.bukkit.helper;
/**
* Bukkit specific implementation of DynmapWorld
*/
@ -177,9 +177,7 @@ public class BukkitWorld extends DynmapWorld {
@Override
public MapChunkCache getChunkCache(List<DynmapChunk> chunks) {
if(isLoaded()) {
NewMapChunkCache c = new NewMapChunkCache();
c.setChunks(this, chunks);
return c;
return BukkitVersionHelper.helper.getChunkCache(this, chunks);
}
else {
return null;
@ -244,6 +242,6 @@ public class BukkitWorld extends DynmapWorld {
}
@Override
public Polygon getWorldBorder() {
return DynmapPlugin.plugin.getWorldBorder(world);
return BukkitVersionHelper.helper.getWorldBorder(world);
}
}

View File

@ -1,4 +1,4 @@
package org.dynmap.bukkit;
package org.dynmap.bukkit.helper;
import java.util.ArrayList;
import java.util.List;
@ -13,7 +13,7 @@ import org.dynmap.DynmapChunk;
import org.dynmap.DynmapCore;
import org.dynmap.DynmapWorld;
import org.dynmap.Log;
import org.dynmap.bukkit.SnapshotCache.SnapshotRec;
import org.dynmap.bukkit.helper.SnapshotCache.SnapshotRec;
import org.dynmap.common.BiomeMap;
import org.dynmap.hdmap.HDBlockModels;
import org.dynmap.renderer.DynmapBlockState;
@ -50,9 +50,7 @@ public class NewMapChunkCache extends MapChunkCache {
private boolean[][] isSectionNotEmpty; /* Indexed by snapshot index, then by section index */
private long[] inhabitedTicks; /* Index = (x-x_min) + ((z-z_min)*x_dim) */
private static final BiomeMap[] nullBiomeMap = { BiomeMap.NULL };
private static BukkitVersionHelper helper = BukkitVersionHelper.getHelper();
private static final BlockStep unstep[] = { BlockStep.X_MINUS, BlockStep.Y_MINUS, BlockStep.Z_MINUS,
BlockStep.X_PLUS, BlockStep.Y_PLUS, BlockStep.Z_PLUS };
@ -160,7 +158,7 @@ public class NewMapChunkCache extends MapChunkCache {
biomebase = nullBiomeMap;
}
else {
biomebase = helper.getBiomeBaseFromSnapshot(snap);
biomebase = BukkitVersionHelper.helper.getBiomeBaseFromSnapshot(snap);
}
last_css = snap;
}
@ -168,7 +166,7 @@ public class NewMapChunkCache extends MapChunkCache {
bm = BiomeMap.NULL;
}
else if(biomebase != null) {
bm = BiomeMap.byBiomeID(helper.getBiomeBaseID(biomebase[bz << 4 | bx]));
bm = BiomeMap.byBiomeID(BukkitVersionHelper.helper.getBiomeBaseID(biomebase[bz << 4 | bx]));
}
else {
Biome bb = snap.getBiome(bx, bz);
@ -745,7 +743,7 @@ public class NewMapChunkCache extends MapChunkCache {
public int loadChunks(int max_to_load) {
if(dw.isLoaded() == false)
return 0;
Object queue = helper.getUnloadQueue(w);
Object queue = BukkitVersionHelper.helper.getUnloadQueue(w);
int cnt = 0;
if(iterator == null)
@ -779,7 +777,7 @@ public class NewMapChunkCache extends MapChunkCache {
ChunkSnapshot ss = null;
long inhabited_ticks = 0;
DynIntHashMap tileData = null;
SnapshotRec ssr = DynmapPlugin.plugin.sscache.getSnapshot(dw.getName(), chunk.x, chunk.z, blockdata, biome, biomeraw, highesty);
SnapshotRec ssr = SnapshotCache.sscache.getSnapshot(dw.getName(), chunk.x, chunk.z, blockdata, biome, biomeraw, highesty);
if(ssr != null) {
ss = ssr.ss;
inhabited_ticks = ssr.inhabitedTicks;
@ -803,7 +801,7 @@ public class NewMapChunkCache extends MapChunkCache {
boolean didload = false;
boolean isunloadpending = false;
if (queue != null) {
isunloadpending = helper.isInUnloadQueue(queue, chunk.x, chunk.z);
isunloadpending = BukkitVersionHelper.helper.isInUnloadQueue(queue, chunk.x, chunk.z);
}
if (isunloadpending) { /* Workaround: can't be pending if not loaded */
wasLoaded = true;
@ -822,7 +820,7 @@ public class NewMapChunkCache extends MapChunkCache {
Chunk c = w.getChunkAt(chunk.x, chunk.z); /* Get the chunk */
/* Get inhabited ticks count */
inhabited_ticks = helper.getInhabitedTicks(c);
inhabited_ticks = BukkitVersionHelper.helper.getInhabitedTicks(c);
if(!vis) {
if(hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN)
ss = STONE;
@ -836,20 +834,20 @@ public class NewMapChunkCache extends MapChunkCache {
ss = c.getChunkSnapshot(highesty, biome, biomeraw);
/* Get tile entity data */
List<Object> vals = new ArrayList<Object>();
Map<?,?> tileents = helper.getTileEntitiesForChunk(c);
Map<?,?> tileents = BukkitVersionHelper.helper.getTileEntitiesForChunk(c);
for(Object t : tileents.values()) {
int te_x = helper.getTileEntityX(t);
int te_y = helper.getTileEntityY(t);
int te_z = helper.getTileEntityZ(t);
int te_x = BukkitVersionHelper.helper.getTileEntityX(t);
int te_y = BukkitVersionHelper.helper.getTileEntityY(t);
int te_z = BukkitVersionHelper.helper.getTileEntityZ(t);
int cx = te_x & 0xF;
int cz = te_z & 0xF;
String[] te_fields = HDBlockModels.getTileEntityFieldsNeeded(getTypeAt(ss, cx, te_y, cz));
if(te_fields != null) {
Object nbtcompound = helper.readTileEntityNBT(t);
Object nbtcompound = BukkitVersionHelper.helper.readTileEntityNBT(t);
vals.clear();
for(String id: te_fields) {
Object val = helper.getFieldValue(nbtcompound, id);
Object val = BukkitVersionHelper.helper.getFieldValue(nbtcompound, id);
if(val != null) {
vals.add(id);
vals.add(val);
@ -869,7 +867,7 @@ public class NewMapChunkCache extends MapChunkCache {
ssr.ss = ss;
ssr.inhabitedTicks = inhabited_ticks;
ssr.tileData = tileData;
DynmapPlugin.plugin.sscache.putSnapshot(dw.getName(), chunk.x, chunk.z, ssr, blockdata, biome, biomeraw, highesty);
SnapshotCache.sscache.putSnapshot(dw.getName(), chunk.x, chunk.z, ssr, blockdata, biome, biomeraw, highesty);
}
}
int chunkIndex = (chunk.x-x_min) + (chunk.z - z_min)*x_dim;
@ -886,12 +884,12 @@ public class NewMapChunkCache extends MapChunkCache {
* by the MC base server is 21x21 (or about a 160 block radius).
* Also, if we did generate it, need to save it */
if (w.isChunkInUse(chunk.x, chunk.z) == false) {
if (helper.isUnloadChunkBroken()) {
if (BukkitVersionHelper.helper.isUnloadChunkBroken()) {
// Give up on broken unloadChunk API - lets see if this works
w.unloadChunkRequest(chunk.x, chunk.z);
}
else {
helper.unloadChunkNoSave(w, c, chunk.x, chunk.z);
BukkitVersionHelper.helper.unloadChunkNoSave(w, c, chunk.x, chunk.z);
}
}
endChunkLoad(startTime, ChunkStats.UNLOADED_CHUNKS);

View File

@ -1,4 +1,4 @@
package org.dynmap.bukkit;
package org.dynmap.bukkit.helper;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
@ -12,6 +12,9 @@ import org.bukkit.ChunkSnapshot;
import org.dynmap.utils.DynIntHashMap;
public class SnapshotCache {
public static SnapshotCache sscache;
public static class SnapshotRec {
public ChunkSnapshot ss;
public long inhabitedTicks;

36
helper113/.classpath Normal file
View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

1
helper113/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target/

23
helper113/.project Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>helper113</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

50
helper113/pom.xml Normal file
View File

@ -0,0 +1,50 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-bukkit</artifactId>
<version>3.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>dynmap-helper-113</artifactId>
<name>dynmap-helper-1.13</name>
<groupId>us.dynmap</groupId>
<dependencies>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-helper</artifactId>
<version>3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-api</artifactId>
<version>3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>DynmapCore</artifactId>
<version>3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.13-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.13-R0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>dynmap-repo</id>
<url>http://repo.mikeprimm.com/</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<version>3.0-SNAPSHOT</version>
</project>

View File

@ -0,0 +1,130 @@
package org.dynmap.bukkit.helper.v113;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Server;
import org.bukkit.World;
import org.dynmap.DynmapChunk;
import org.dynmap.Log;
import org.dynmap.bukkit.helper.BukkitVersionHelper;
import org.dynmap.bukkit.helper.BukkitVersionHelperCB;
import org.dynmap.bukkit.helper.BukkitWorld;
import org.dynmap.hdmap.HDBlockModels;
import org.dynmap.renderer.DynmapBlockState;
import org.dynmap.utils.MapChunkCache;
import org.dynmap.utils.Polygon;
import org.dynmap.bukkit.helper.v113.MapChunkCache113;
import net.minecraft.server.v1_13_R1.Block;
import net.minecraft.server.v1_13_R1.IBlockData;
import net.minecraft.server.v1_13_R1.IBlockState;
/**
* Helper for isolation of bukkit version specific issues
*/
public class BukkitVersionHelperSpigot113 extends BukkitVersionHelperCB {
/** CraftChunkSnapshot */
protected Class<?> datapalettearray;
private Field blockid_field;
public BukkitVersionHelperSpigot113() {
datapalettearray = getNMSClass("[Lnet.minecraft.server.DataPaletteBlock;");
blockid_field = getPrivateField(craftchunksnapshot, new String[] { "blockids" }, datapalettearray);
}
@Override
public Object[] getBlockIDFieldFromSnapshot(ChunkSnapshot css) {
try {
return (Object[]) blockid_field.get(css);
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
}
return null;
}
@Override
public void unloadChunkNoSave(World w, Chunk c, int cx, int cz) {
w.unloadChunk(cx, cz, false, false);
}
private String stripBlockString(String bname) {
int idx = bname.indexOf('{');
if (idx >= 0) bname = bname.substring(idx+1);
idx = bname.indexOf('}');
if (idx >= 0) bname = bname.substring(0, idx);
return bname;
}
/**
* Get block short name list
*/
@Override
public String[] getBlockNames() {
int cnt = Block.REGISTRY_ID.a();
String[] names = new String[cnt];
for (int i = 0; i < cnt; i++) {
IBlockData bd = Block.getByCombinedId(i);
names[i] = Block.REGISTRY.b(bd.getBlock()).b();
Log.info(i + ": blk=" + names[i] + ", bd=" + bd.toString());
}
return names;
}
public static IdentityHashMap<IBlockData, DynmapBlockState> dataToState;
/**
* Initialize block states (org.dynmap.blockstate.DynmapBlockState)
*/
@Override
public void initializeBlockStates() {
dataToState = new IdentityHashMap<IBlockData, DynmapBlockState>();
HashMap<String, DynmapBlockState> lastBlockState = new HashMap<String, DynmapBlockState>();
int cnt = Block.REGISTRY_ID.a();
// Loop through block data states
for (int i = 0; i < cnt; i++) {
IBlockData bd = Block.getByCombinedId(i);
String bname = Block.REGISTRY.b(bd.getBlock()).toString();
DynmapBlockState lastbs = lastBlockState.get(bname); // See if we have seen this one
int idx = 0;
if (lastbs != null) { // Yes
idx = lastbs.getStateCount(); // Get number of states so far, since this is next
}
// Build state name
String sb = "";
String fname = bd.toString();
int off1 = fname.indexOf('[');
if (off1 >= 0) {
int off2 = fname.indexOf(']');
sb = fname.substring(off1+1, off2);
}
DynmapBlockState bs = new DynmapBlockState(lastbs, idx, bname, sb);
dataToState.put(bd, bs);
lastBlockState.put(bname, (lastbs == null) ? bs : lastbs);
Log.info(i + ": blk=" + bname + ", idx=" + idx + ", state=" + sb);
}
}
/**
* Create chunk cache for given chunks of given world
* @param dw - world
* @param chunks - chunk list
* @return cache
*/
@Override
public MapChunkCache getChunkCache(BukkitWorld dw, List<DynmapChunk> chunks) {
MapChunkCache113 c = new MapChunkCache113();
c.setChunks(dw, chunks);
return c;
}
}

File diff suppressed because it is too large Load Diff

157
pom.xml
View File

@ -2,8 +2,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>us.dynmap</groupId>
<artifactId>dynmap</artifactId>
<name>dynmap</name>
<artifactId>dynmap-bukkit</artifactId>
<name>dynmap-bukkit</name>
<properties>
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
@ -15,152 +15,11 @@
<system>GitHub</system>
<url>https://github.com/webbukkit/dynmap/issues</url>
</issueManagement>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>*.yml</include>
<include>*.txt</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>*.yml</exclude>
<exclude>*.txt</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<artifactSet>
<includes>
<include>org.bstats:*</include>
<include>us.dynmap:dynmap-api:jar:*</include>
<include>us.dynmap:DynmapCore:jar:*</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>org.dynmap</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<releases>
</releases>
<snapshots>
</snapshots>
<id>dynmap-repo</id>
<url>http://repo.mikeprimm.com/</url>
</repository>
<repository>
<id>bstats-repo</id>
<url>http://repo.bstats.org/content/repositories/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.nijikokun.bukkit</groupId>
<artifactId>Permissions</artifactId>
<version>3.1.6</version>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.7.10-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>dynmap-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>us.dynmap</groupId>
<artifactId>DynmapCore</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.tehkode</groupId>
<artifactId>PermissionsEx</artifactId>
<version>1.19.1</version>
</dependency>
<dependency>
<groupId>de.bananaco</groupId>
<artifactId>bPermissions</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>com.platymuus.bukkit.permissions</groupId>
<artifactId>PermissionsBukkit</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.anjocaido</groupId>
<artifactId>EssentialsGroupManager</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
</dependencies>
<packaging>pom</packaging>
<modules>
<module>core</module>
<module>helper113</module>
<module>helper</module>
</modules>
<version>3.0-SNAPSHOT</version>
</project>