mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-23 18:55:14 +01:00
Shift old spigot/paper support to dynamic load to handle pedantic Paper
loader
This commit is contained in:
parent
105d4f1b62
commit
b310a57b64
@ -8,6 +8,8 @@ eclipse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':DynmapCoreAPI')
|
implementation project(':DynmapCoreAPI')
|
||||||
implementation 'javax.servlet:javax.servlet-api:3.1'
|
implementation 'javax.servlet:javax.servlet-api:3.1'
|
||||||
|
@ -8,6 +8,8 @@ eclipse {
|
|||||||
|
|
||||||
description = 'bukkit-helper-1.13.2'
|
description = 'bukkit-helper-1.13.2'
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':bukkit-helper')
|
implementation project(':bukkit-helper')
|
||||||
implementation project(':dynmap-api')
|
implementation project(':dynmap-api')
|
||||||
|
@ -6,6 +6,8 @@ eclipse {
|
|||||||
|
|
||||||
description = 'bukkit-helper-1.14.1'
|
description = 'bukkit-helper-1.14.1'
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':bukkit-helper')
|
implementation project(':bukkit-helper')
|
||||||
implementation project(':dynmap-api')
|
implementation project(':dynmap-api')
|
||||||
|
@ -6,6 +6,8 @@ eclipse {
|
|||||||
|
|
||||||
description = 'bukkit-helper-1.15'
|
description = 'bukkit-helper-1.15'
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':bukkit-helper')
|
implementation project(':bukkit-helper')
|
||||||
implementation project(':dynmap-api')
|
implementation project(':dynmap-api')
|
||||||
|
@ -6,6 +6,8 @@ eclipse {
|
|||||||
|
|
||||||
description = 'bukkit-helper-1.16.2'
|
description = 'bukkit-helper-1.16.2'
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':bukkit-helper')
|
implementation project(':bukkit-helper')
|
||||||
implementation project(':dynmap-api')
|
implementation project(':dynmap-api')
|
||||||
|
@ -6,6 +6,8 @@ eclipse {
|
|||||||
|
|
||||||
description = 'bukkit-helper-1.16.3'
|
description = 'bukkit-helper-1.16.3'
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':bukkit-helper')
|
implementation project(':bukkit-helper')
|
||||||
implementation project(':dynmap-api')
|
implementation project(':dynmap-api')
|
||||||
|
@ -6,6 +6,8 @@ eclipse {
|
|||||||
|
|
||||||
description = 'bukkit-helper-1.16.4'
|
description = 'bukkit-helper-1.16.4'
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':bukkit-helper')
|
implementation project(':bukkit-helper')
|
||||||
implementation project(':dynmap-api')
|
implementation project(':dynmap-api')
|
||||||
|
@ -6,6 +6,8 @@ eclipse {
|
|||||||
|
|
||||||
description = 'bukkit-helper-1.16'
|
description = 'bukkit-helper-1.16'
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':bukkit-helper')
|
implementation project(':bukkit-helper')
|
||||||
implementation project(':dynmap-api')
|
implementation project(':dynmap-api')
|
||||||
|
@ -2,7 +2,7 @@ arguments=
|
|||||||
auto.sync=false
|
auto.sync=false
|
||||||
build.scans.enabled=false
|
build.scans.enabled=false
|
||||||
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3))
|
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3))
|
||||||
connection.project.dir=..
|
connection.project.dir=../bukkit-helper-119-4
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
gradle.user.home=
|
gradle.user.home=
|
||||||
java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home
|
java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
#Tue Jun 20 20:08:06 CDT 2023
|
#Sat Aug 19 16:59:43 CDT 2023
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
@ -8,6 +8,8 @@ eclipse {
|
|||||||
|
|
||||||
description = 'bukkit-helper'
|
description = 'bukkit-helper'
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':dynmap-api')
|
implementation project(':dynmap-api')
|
||||||
implementation project(path: ':DynmapCore', configuration: 'shadow')
|
implementation project(path: ':DynmapCore', configuration: 'shadow')
|
||||||
|
@ -8,6 +8,8 @@ eclipse {
|
|||||||
|
|
||||||
description = "dynmap-api"
|
description = "dynmap-api"
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly group: 'org.bukkit', name: 'bukkit', version:'1.7.10-R0.1-SNAPSHOT'
|
compileOnly group: 'org.bukkit', name: 'bukkit', version:'1.7.10-R0.1-SNAPSHOT'
|
||||||
compileOnly project(":DynmapCoreAPI")
|
compileOnly project(":DynmapCoreAPI")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.dynmap.forge_1_18_2;
|
package org.dynmap.forge_1_18_2;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
@ -10,6 +11,7 @@ import org.dynmap.common.BiomeMap;
|
|||||||
import org.dynmap.common.chunk.GenericChunk;
|
import org.dynmap.common.chunk.GenericChunk;
|
||||||
import org.dynmap.common.chunk.GenericChunkCache;
|
import org.dynmap.common.chunk.GenericChunkCache;
|
||||||
import org.dynmap.common.chunk.GenericMapChunkCache;
|
import org.dynmap.common.chunk.GenericMapChunkCache;
|
||||||
|
import org.dynmap.utils.TileFlags;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.server.level.ServerChunkCache;
|
import net.minecraft.server.level.ServerChunkCache;
|
||||||
@ -65,6 +67,8 @@ public class ForgeMapChunkCache extends GenericMapChunkCache {
|
|||||||
super.setChunks(dw, chunks);
|
super.setChunks(dw, chunks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static HashMap<String, TileFlags> tmap = new HashMap<String, TileFlags>();
|
||||||
|
|
||||||
private CompoundTag readChunk(int x, int z) {
|
private CompoundTag readChunk(int x, int z) {
|
||||||
try {
|
try {
|
||||||
CompoundTag rslt = cps.chunkMap.read(new ChunkPos(x, z));
|
CompoundTag rslt = cps.chunkMap.read(new ChunkPos(x, z));
|
||||||
@ -82,6 +86,30 @@ public class ForgeMapChunkCache extends GenericMapChunkCache {
|
|||||||
rslt = null;
|
rslt = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (rslt != null) {
|
||||||
|
int version = rslt.getInt("DataVersion");
|
||||||
|
if (version < 2975) {
|
||||||
|
boolean doIt = false;
|
||||||
|
synchronized(tmap) {
|
||||||
|
TileFlags tf = tmap.get(dw.getName());
|
||||||
|
if (tf == null) {
|
||||||
|
tf = new TileFlags();
|
||||||
|
tmap.put(dw.getName(), tf);
|
||||||
|
}
|
||||||
|
if (!tf.getFlag(x, z)) {
|
||||||
|
tf.setFlag(x, z, true);
|
||||||
|
doIt = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (doIt) {
|
||||||
|
ChunkPos pos = new ChunkPos(x, z);
|
||||||
|
CompoundTag newrec = cps.chunkMap.readChunk(pos);
|
||||||
|
if (rslt != null) {
|
||||||
|
cps.chunkMap.write(pos, newrec.copy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Log.info(String.format("loadChunk(%d,%d)=%s", x, z, (rslt != null) ?
|
// Log.info(String.format("loadChunk(%d,%d)=%s", x, z, (rslt != null) ?
|
||||||
// rslt.toString() : "null"));
|
// rslt.toString() : "null"));
|
||||||
return rslt;
|
return rslt;
|
||||||
|
@ -16,6 +16,8 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation('org.bukkit:bukkit:1.10.2-R0.1-SNAPSHOT') { transitive = false }
|
implementation('org.bukkit:bukkit:1.10.2-R0.1-SNAPSHOT') { transitive = false }
|
||||||
compileOnly('com.nijikokun.bukkit:Permissions:3.1.6') { transitive = false }
|
compileOnly('com.nijikokun.bukkit:Permissions:3.1.6') { transitive = false }
|
||||||
|
@ -1,27 +1,23 @@
|
|||||||
package org.dynmap.bukkit;
|
package org.dynmap.bukkit;
|
||||||
|
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.dynmap.Log;
|
import org.dynmap.Log;
|
||||||
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
||||||
import org.dynmap.bukkit.helper.BukkitVersionHelperCB;
|
|
||||||
import org.dynmap.bukkit.helper.BukkitVersionHelperGlowstone;
|
|
||||||
import org.dynmap.bukkit.helper.v113_2.BukkitVersionHelperSpigot113_2;
|
|
||||||
import org.dynmap.bukkit.helper.v114_1.BukkitVersionHelperSpigot114_1;
|
|
||||||
import org.dynmap.bukkit.helper.v115.BukkitVersionHelperSpigot115;
|
|
||||||
import org.dynmap.bukkit.helper.v116.BukkitVersionHelperSpigot116;
|
|
||||||
import org.dynmap.bukkit.helper.v116_2.BukkitVersionHelperSpigot116_2;
|
|
||||||
import org.dynmap.bukkit.helper.v116_3.BukkitVersionHelperSpigot116_3;
|
|
||||||
import org.dynmap.bukkit.helper.v116_4.BukkitVersionHelperSpigot116_4;
|
|
||||||
import org.dynmap.bukkit.helper.v117.BukkitVersionHelperSpigot117;
|
|
||||||
import org.dynmap.bukkit.helper.v118.BukkitVersionHelperSpigot118;
|
|
||||||
import org.dynmap.bukkit.helper.v118_2.BukkitVersionHelperSpigot118_2;
|
|
||||||
import org.dynmap.bukkit.helper.v119.BukkitVersionHelperSpigot119;
|
|
||||||
import org.dynmap.bukkit.helper.v119_3.BukkitVersionHelperSpigot119_3;
|
|
||||||
import org.dynmap.bukkit.helper.v119_4.BukkitVersionHelperSpigot119_4;
|
|
||||||
import org.dynmap.bukkit.helper.v120.BukkitVersionHelperSpigot120;
|
|
||||||
|
|
||||||
public class Helper {
|
public class Helper {
|
||||||
|
|
||||||
|
private static BukkitVersionHelper loadVersionHelper(String classname) {
|
||||||
|
try {
|
||||||
|
Class<?> c = Class.forName(classname);
|
||||||
|
Constructor<?> cons = c.getConstructor();
|
||||||
|
return (BukkitVersionHelper) cons.newInstance();
|
||||||
|
} catch (Exception x) {
|
||||||
|
Log.severe("Error loading " + classname, x);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
public static final BukkitVersionHelper getHelper() {
|
public static final BukkitVersionHelper getHelper() {
|
||||||
if (BukkitVersionHelper.helper == null) {
|
if (BukkitVersionHelper.helper == null) {
|
||||||
String v = Bukkit.getServer().getVersion();
|
String v = Bukkit.getServer().getVersion();
|
||||||
@ -42,57 +38,57 @@ public class Helper {
|
|||||||
}
|
}
|
||||||
else if(Bukkit.getServer().getClass().getName().contains("GlowServer")) {
|
else if(Bukkit.getServer().getClass().getName().contains("GlowServer")) {
|
||||||
Log.info("Loading Glowstone support");
|
Log.info("Loading Glowstone support");
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperGlowstone();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.BukkitVersionHelperGlowstone");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.20")) {
|
else if (v.contains("(MC: 1.20")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot120();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v120.BukkitVersionHelperSpigot120");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.19)") || v.contains("(MC: 1.19.1)") || v.contains("(MC: 1.19.2)")) {
|
else if (v.contains("(MC: 1.19)") || v.contains("(MC: 1.19.1)") || v.contains("(MC: 1.19.2)")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot119();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v119.BukkitVersionHelperSpigot119");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.19.3)")) {
|
else if (v.contains("(MC: 1.19.3)")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot119_3();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v119_3.BukkitVersionHelperSpigot119_3");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.19.")) {
|
else if (v.contains("(MC: 1.19.")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot119_4();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v119_4.BukkitVersionHelperSpigot119_4");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.18)") || (v.contains("(MC: 1.18.1)"))) {
|
else if (v.contains("(MC: 1.18)") || (v.contains("(MC: 1.18.1)"))) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot118();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v118.BukkitVersionHelperSpigot118");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.18")) {
|
else if (v.contains("(MC: 1.18")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot118_2();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v118_2.BukkitVersionHelperSpigot118_2");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.17")) {
|
else if (v.contains("(MC: 1.17")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot117();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v117.BukkitVersionHelperSpigot117");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.16.1")) {
|
else if (v.contains("(MC: 1.16.1")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot116();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v116.BukkitVersionHelperSpigot116");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.16.2)")) {
|
else if (v.contains("(MC: 1.16.2)")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot116_2();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v116_2.BukkitVersionHelperSpigot116_2");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.16.3)")) {
|
else if (v.contains("(MC: 1.16.3)")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot116_3();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v116_3.BukkitVersionHelperSpigot116_3");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.16.")) {
|
else if (v.contains("(MC: 1.16.")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot116_4();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v116_4.BukkitVersionHelperSpigot116_4");
|
||||||
}
|
}
|
||||||
// Loading last to prevent the 1.16 contains to match all newer versions and load older helper incorrectly.
|
// Loading last to prevent the 1.16 contains to match all newer versions and load older helper incorrectly.
|
||||||
else if (v.contains("(MC: 1.16")) {
|
else if (v.contains("(MC: 1.16")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot116();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v116.BukkitVersionHelperSpigot116");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.15)") || v.contains("(MC: 1.15.")) {
|
else if (v.contains("(MC: 1.15)") || v.contains("(MC: 1.15.")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot115();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v115.BukkitVersionHelperSpigot115");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.14)") || v.contains("(MC: 1.14.1)") || v.contains("(MC: 1.14.2)") ||
|
else if (v.contains("(MC: 1.14)") || v.contains("(MC: 1.14.1)") || v.contains("(MC: 1.14.2)") ||
|
||||||
v.contains("(MC: 1.14.3)") || v.contains("(MC: 1.14.4)")) {
|
v.contains("(MC: 1.14.3)") || v.contains("(MC: 1.14.4)")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot114_1();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v114_1.BukkitVersionHelperSpigot114_1");
|
||||||
}
|
}
|
||||||
else if (v.contains("(MC: 1.13.2)")) {
|
else if (v.contains("(MC: 1.13.2)")) {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperSpigot113_2();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.v113_2.BukkitVersionHelperSpigot113_2");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BukkitVersionHelper.helper = new BukkitVersionHelperCB();
|
BukkitVersionHelper.helper = loadVersionHelper("org.dynmap.bukkit.helper.BukkitVersionHelperCB");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BukkitVersionHelper.helper;
|
return BukkitVersionHelper.helper;
|
||||||
|
Loading…
Reference in New Issue
Block a user