mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-13 05:54:40 +01:00
Fix spaces
* fix 1.16.2 spaces * fix 1.16.4 spaces * fix 1.16 * fix 1.16.0 x2 * fix 1.17 * fix 1.18.2 * fix 1.18.2 map cache * fix 1.18.2 map cache p2 * fix 1.18 * fix 1.16.3
This commit is contained in:
parent
b0f0a4deb5
commit
de510108a2
@ -37,14 +37,14 @@ import net.minecraft.server.v1_16_R2.MinecraftServer;
|
||||
* Helper for isolation of bukkit version specific issues
|
||||
*/
|
||||
public class BukkitVersionHelperSpigot116_2 extends BukkitVersionHelperGeneric {
|
||||
private final boolean unsafeAsync;
|
||||
private Field watercolorfield;
|
||||
private final boolean unsafeAsync;
|
||||
private Field watercolorfield;
|
||||
|
||||
public BukkitVersionHelperSpigot116_2() {
|
||||
Class biomefog = getNMSClass("net.minecraft.server.BiomeFog");
|
||||
watercolorfield = getPrivateField(biomefog, new String[] { "c" }, int.class);
|
||||
this.unsafeAsync = true;
|
||||
}
|
||||
this.unsafeAsync = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get block short name list
|
||||
|
@ -37,14 +37,14 @@ import net.minecraft.server.v1_16_R2.BlockPosition;
|
||||
* Helper for isolation of bukkit version specific issues
|
||||
*/
|
||||
public class BukkitVersionHelperSpigot116_3 extends BukkitVersionHelperGeneric {
|
||||
private final boolean unsafeAsync;
|
||||
private Field watercolorfield;
|
||||
private final boolean unsafeAsync;
|
||||
private Field watercolorfield;
|
||||
|
||||
public BukkitVersionHelperSpigot116_3() {
|
||||
Class biomefog = getNMSClass("net.minecraft.server.BiomeFog");
|
||||
watercolorfield = getPrivateField(biomefog, new String[] { "c" }, int.class);
|
||||
this.unsafeAsync = true;
|
||||
}
|
||||
Class biomefog = getNMSClass("net.minecraft.server.BiomeFog");
|
||||
watercolorfield = getPrivateField(biomefog, new String[] { "c" }, int.class);
|
||||
this.unsafeAsync = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get block short name list
|
||||
@ -72,12 +72,12 @@ public class BukkitVersionHelperSpigot116_3 extends BukkitVersionHelperGeneric {
|
||||
|
||||
private Object[] biomelist;
|
||||
|
||||
@Override
|
||||
public boolean isUnsafeAsync() {
|
||||
return unsafeAsync;
|
||||
}
|
||||
@Override
|
||||
public boolean isUnsafeAsync() {
|
||||
return unsafeAsync;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get list of defined biomebase objects
|
||||
*/
|
||||
@Override
|
||||
|
@ -26,14 +26,14 @@ import java.util.List;
|
||||
* Helper for isolation of bukkit version specific issues
|
||||
*/
|
||||
public class BukkitVersionHelperSpigot116_4 extends BukkitVersionHelperGeneric {
|
||||
private final boolean unsafeAsync;
|
||||
private Field watercolorfield;
|
||||
private final boolean unsafeAsync;
|
||||
private Field watercolorfield;
|
||||
|
||||
public BukkitVersionHelperSpigot116_4() {
|
||||
Class biomefog = getNMSClass("net.minecraft.server.BiomeFog");
|
||||
watercolorfield = getPrivateField(biomefog, new String[] { "c" }, int.class);
|
||||
this.unsafeAsync = true;
|
||||
}
|
||||
this.unsafeAsync = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get block short name list
|
||||
@ -61,12 +61,12 @@ public class BukkitVersionHelperSpigot116_4 extends BukkitVersionHelperGeneric {
|
||||
|
||||
private Object[] biomelist;
|
||||
|
||||
@Override
|
||||
public boolean isUnsafeAsync() {
|
||||
return unsafeAsync;
|
||||
}
|
||||
@Override
|
||||
public boolean isUnsafeAsync() {
|
||||
return unsafeAsync;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get list of defined biomebase objects
|
||||
*/
|
||||
@Override
|
||||
|
@ -42,8 +42,8 @@ public class BukkitVersionHelperSpigot116 extends BukkitVersionHelperGeneric {
|
||||
public BukkitVersionHelperSpigot116() {
|
||||
Class biomefog = getNMSClass("net.minecraft.server.BiomeFog");
|
||||
watercolorfield = getPrivateField(biomefog, new String[] { "c" }, int.class);
|
||||
this.unsafeAsync = true;
|
||||
}
|
||||
this.unsafeAsync = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get block short name list
|
||||
@ -62,12 +62,12 @@ public class BukkitVersionHelperSpigot116 extends BukkitVersionHelperGeneric {
|
||||
|
||||
private Object[] biomelist;
|
||||
|
||||
@Override
|
||||
public boolean isUnsafeAsync() {
|
||||
return unsafeAsync;
|
||||
}
|
||||
@Override
|
||||
public boolean isUnsafeAsync() {
|
||||
return unsafeAsync;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get list of defined biomebase objects
|
||||
*/
|
||||
@Override
|
||||
|
@ -59,18 +59,18 @@ import java.util.Map;
|
||||
* Helper for isolation of bukkit version specific issues
|
||||
*/
|
||||
public class BukkitVersionHelperSpigot117 extends BukkitVersionHelper {
|
||||
private final boolean unsafeAsync;
|
||||
private final boolean unsafeAsync;
|
||||
|
||||
public BukkitVersionHelperSpigot117() {
|
||||
this.unsafeAsync = true;
|
||||
public BukkitVersionHelperSpigot117() {
|
||||
this.unsafeAsync = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUnsafeAsync() {
|
||||
return unsafeAsync;
|
||||
}
|
||||
@Override
|
||||
public boolean isUnsafeAsync() {
|
||||
return unsafeAsync;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get block short name list
|
||||
*/
|
||||
@Override
|
||||
|
@ -64,25 +64,25 @@ import java.util.Set;
|
||||
* Helper for isolation of bukkit version specific issues
|
||||
*/
|
||||
public class BukkitVersionHelperSpigot118_2 extends BukkitVersionHelper {
|
||||
private final boolean unsafeAsync;
|
||||
private final boolean unsafeAsync;
|
||||
|
||||
public BukkitVersionHelperSpigot118_2() {
|
||||
boolean unsafeAsync1;
|
||||
try {
|
||||
Class.forName("com.destroystokyo.paper.io.PaperFileIOThread");
|
||||
unsafeAsync1 = false;
|
||||
} catch (ClassNotFoundException e) {
|
||||
unsafeAsync1 = true;
|
||||
}
|
||||
this.unsafeAsync = unsafeAsync1;
|
||||
}
|
||||
boolean unsafeAsync1;
|
||||
try {
|
||||
Class.forName("com.destroystokyo.paper.io.PaperFileIOThread");
|
||||
unsafeAsync1 = false;
|
||||
} catch (ClassNotFoundException e) {
|
||||
unsafeAsync1 = true;
|
||||
}
|
||||
this.unsafeAsync = unsafeAsync1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUnsafeAsync() {
|
||||
return unsafeAsync;
|
||||
}
|
||||
@Override
|
||||
public boolean isUnsafeAsync() {
|
||||
return unsafeAsync;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get block short name list
|
||||
*/
|
||||
@Override
|
||||
|
@ -25,57 +25,56 @@ import java.util.concurrent.CompletableFuture;
|
||||
* Container for managing chunks - dependent upon using chunk snapshots, since rendering is off server thread
|
||||
*/
|
||||
public class MapChunkCache118_2 extends GenericMapChunkCache {
|
||||
private final AsyncChunkProvider118_2 provider = BukkitVersionHelper.helper.isUnsafeAsync() ? null : new AsyncChunkProvider118_2();
|
||||
private World w;
|
||||
/**
|
||||
* Construct empty cache
|
||||
*/
|
||||
public MapChunkCache118_2(GenericChunkCache cc) {
|
||||
super(cc);
|
||||
}
|
||||
|
||||
// Load generic chunk from existing and already loaded chunk
|
||||
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
|
||||
CraftWorld cw = (CraftWorld) w;
|
||||
NBTTagCompound nbt = null;
|
||||
GenericChunk gc = null;
|
||||
if (cw.isChunkLoaded(chunk.x, chunk.z)) {
|
||||
Chunk c = cw.getHandle().getChunkIfLoaded(chunk.x, chunk.z); //already safe async on vanilla
|
||||
if ((c != null) && c.o) { // c.loaded
|
||||
if (provider == null) { //idk why, but paper uses this only sync, so I won't be smarter
|
||||
nbt = ChunkRegionLoader.a(cw.getHandle(), c);
|
||||
} else {
|
||||
nbt = CompletableFuture.supplyAsync(() -> ChunkRegionLoader.a(cw.getHandle(), c), ((CraftServer) Bukkit.getServer()).getServer()).join();
|
||||
}
|
||||
}
|
||||
if (nbt != null) {
|
||||
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
|
||||
}
|
||||
private final AsyncChunkProvider118_2 provider = BukkitVersionHelper.helper.isUnsafeAsync() ? null : new AsyncChunkProvider118_2();
|
||||
private World w;
|
||||
/**
|
||||
* Construct empty cache
|
||||
*/
|
||||
public MapChunkCache118_2(GenericChunkCache cc) {
|
||||
super(cc);
|
||||
}
|
||||
return gc;
|
||||
}
|
||||
// Load generic chunk from unloaded chunk
|
||||
protected GenericChunk loadChunk(DynmapChunk chunk) {
|
||||
|
||||
// Load generic chunk from existing and already loaded chunk
|
||||
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
|
||||
CraftWorld cw = (CraftWorld) w;
|
||||
NBTTagCompound nbt = null;
|
||||
GenericChunk gc = null;
|
||||
if (cw.isChunkLoaded(chunk.x, chunk.z)) {
|
||||
Chunk c = cw.getHandle().getChunkIfLoaded(chunk.x, chunk.z); //already safe async on vanilla
|
||||
if ((c != null) && c.o) { // c.loaded
|
||||
if (provider == null) { //idk why, but paper uses this only sync, so I won't be smarter
|
||||
nbt = ChunkRegionLoader.a(cw.getHandle(), c);
|
||||
} else {
|
||||
nbt = CompletableFuture.supplyAsync(() -> ChunkRegionLoader.a(cw.getHandle(), c), ((CraftServer) Bukkit.getServer()).getServer()).join();
|
||||
}
|
||||
}
|
||||
if (nbt != null) {
|
||||
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
|
||||
}
|
||||
}
|
||||
return gc;
|
||||
}
|
||||
// Load generic chunk from unloaded chunk
|
||||
protected GenericChunk loadChunk(DynmapChunk chunk) {
|
||||
CraftWorld cw = (CraftWorld) w;
|
||||
NBTTagCompound nbt = null;
|
||||
ChunkCoordIntPair cc = new ChunkCoordIntPair(chunk.x, chunk.z);
|
||||
GenericChunk gc = null;
|
||||
try {
|
||||
if (provider == null){
|
||||
nbt = cw.getHandle().k().a.f(cc); // playerChunkMap
|
||||
} else {
|
||||
nbt = provider.getChunk(cw.getHandle(),chunk.x, chunk.z);
|
||||
}
|
||||
} catch (IOException | InvocationTargetException | IllegalAccessException | NoSuchFieldException ignored) {
|
||||
}
|
||||
if (provider == null){
|
||||
nbt = cw.getHandle().k().a.f(cc); // playerChunkMap
|
||||
} else {
|
||||
nbt = provider.getChunk(cw.getHandle(),chunk.x, chunk.z);
|
||||
}
|
||||
} catch (IOException | InvocationTargetException | IllegalAccessException | NoSuchFieldException ignored) {}
|
||||
if (nbt != null) {
|
||||
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
|
||||
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
|
||||
}
|
||||
return gc;
|
||||
}
|
||||
return gc;
|
||||
}
|
||||
|
||||
public void setChunks(BukkitWorld dw, List<DynmapChunk> chunks) {
|
||||
this.w = dw.getWorld();
|
||||
super.setChunks(dw, chunks);
|
||||
}
|
||||
public void setChunks(BukkitWorld dw, List<DynmapChunk> chunks) {
|
||||
this.w = dw.getWorld();
|
||||
super.setChunks(dw, chunks);
|
||||
}
|
||||
}
|
||||
|
@ -64,19 +64,18 @@ import java.util.Set;
|
||||
* Helper for isolation of bukkit version specific issues
|
||||
*/
|
||||
public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
|
||||
private final boolean unsafeAsync;
|
||||
|
||||
private final boolean unsafeAsync;
|
||||
|
||||
public BukkitVersionHelperSpigot118() {
|
||||
this.unsafeAsync = true;
|
||||
public BukkitVersionHelperSpigot118() {
|
||||
this.unsafeAsync = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUnsafeAsync() {
|
||||
return unsafeAsync;
|
||||
}
|
||||
@Override
|
||||
public boolean isUnsafeAsync() {
|
||||
return unsafeAsync;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get block short name list
|
||||
*/
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user