mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-27 12:45:59 +01:00
Forge 1.20 - start Spigot 1.20
This commit is contained in:
parent
5aeca48e2b
commit
2d835eaeec
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"java.configuration.updateBuildConfiguration": "automatic"
|
"java.configuration.updateBuildConfiguration": "automatic",
|
||||||
|
"java.compile.nullAnalysis.mode": "automatic"
|
||||||
}
|
}
|
2
bukkit-helper-120/.gitignore
vendored
Normal file
2
bukkit-helper-120/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/build/
|
||||||
|
/bin/
|
17
bukkit-helper-120/build.gradle
Normal file
17
bukkit-helper-120/build.gradle
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
eclipse {
|
||||||
|
project {
|
||||||
|
name = "Dynmap(Spigot-1.20)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
description = 'bukkit-helper-1.20'
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaLanguageVersion.of(17) // Need this here so eclipse task generates correctly.
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(':bukkit-helper')
|
||||||
|
implementation project(':dynmap-api')
|
||||||
|
implementation project(path: ':DynmapCore', configuration: 'shadow')
|
||||||
|
implementation group: 'org.spigotmc', name: 'spigot-api', version:'1.20-R0.1-SNAPSHOT'
|
||||||
|
implementation group: 'org.spigotmc', name: 'spigot', version:'1.20-R0.1-SNAPSHOT'
|
||||||
|
}
|
@ -0,0 +1,130 @@
|
|||||||
|
package org.dynmap.bukkit.helper.v120;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.level.WorldServer;
|
||||||
|
import net.minecraft.world.level.chunk.Chunk;
|
||||||
|
import net.minecraft.world.level.chunk.IChunkAccess;
|
||||||
|
import net.minecraft.world.level.chunk.storage.ChunkRegionLoader;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.craftbukkit.v1_20_R1.CraftServer;
|
||||||
|
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
|
||||||
|
import org.dynmap.MapManager;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The provider used to work with paper libs
|
||||||
|
* Because paper libs need java 17 we can't interact with them directly
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"JavaReflectionMemberAccess"}) //java don't know about paper
|
||||||
|
public class AsyncChunkProvider120 {
|
||||||
|
private final Method getChunk;
|
||||||
|
private final Method getAsyncSaveData;
|
||||||
|
private final Method save;
|
||||||
|
private final Enum<?> data;
|
||||||
|
private final Enum<?> priority;
|
||||||
|
private int currTick = MinecraftServer.currentTick;
|
||||||
|
private int currChunks = 0;
|
||||||
|
|
||||||
|
AsyncChunkProvider120() {
|
||||||
|
try {
|
||||||
|
Method getChunk1 = null;
|
||||||
|
Method getAsyncSaveData1 = null;
|
||||||
|
Method save1 = null;
|
||||||
|
Enum<?> priority1 = null;
|
||||||
|
Enum<?> data1 = null;
|
||||||
|
try {
|
||||||
|
Class<?> threadClass = Class.forName("io.papermc.paper.chunk.system.io.RegionFileIOThread");
|
||||||
|
|
||||||
|
Class<?> dataclass = Arrays.stream(threadClass.getDeclaredClasses())
|
||||||
|
.filter(c -> c.getSimpleName().equals("RegionFileType"))
|
||||||
|
.findAny()
|
||||||
|
.orElseThrow(NullPointerException::new);
|
||||||
|
data1 = Enum.valueOf(cast(dataclass), "CHUNK_DATA");
|
||||||
|
|
||||||
|
Class<?> priorityClass = Arrays.stream(Class.forName("ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor").getClasses())
|
||||||
|
.filter(c -> c.getSimpleName().equals("Priority"))
|
||||||
|
.findAny()
|
||||||
|
.orElseThrow(NullPointerException::new);
|
||||||
|
//Almost lowest priority, but not quite so low as to be considered idle
|
||||||
|
//COMPLETING->BLOCKING->HIGHEST->HIGHER->HIGH->NORMAL->LOW->LOWER->LOWEST->IDLE
|
||||||
|
priority1 = Enum.valueOf(cast(priorityClass), "LOWEST");
|
||||||
|
|
||||||
|
getAsyncSaveData1 = ChunkRegionLoader.class.getMethod("getAsyncSaveData", WorldServer.class, IChunkAccess.class);
|
||||||
|
save1 = ChunkRegionLoader.class.getMethod("saveChunk", WorldServer.class, IChunkAccess.class, getAsyncSaveData1.getReturnType());
|
||||||
|
getChunk1 = threadClass.getMethod("loadDataAsync", WorldServer.class, int.class, int.class, data1.getClass(), BiConsumer.class, boolean.class, priority1.getClass());
|
||||||
|
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
getAsyncSaveData = Objects.requireNonNull(getAsyncSaveData1);
|
||||||
|
save = Objects.requireNonNull(save1);
|
||||||
|
getChunk = Objects.requireNonNull(getChunk1);
|
||||||
|
data = Objects.requireNonNull(data1);
|
||||||
|
priority = Objects.requireNonNull(priority1);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private <T> T cast(Object o) {
|
||||||
|
return (T) o;
|
||||||
|
}
|
||||||
|
public CompletableFuture<NBTTagCompound> getChunk(WorldServer world, int x, int y) throws InvocationTargetException, IllegalAccessException {
|
||||||
|
CompletableFuture<NBTTagCompound> future = new CompletableFuture<>();
|
||||||
|
getChunk.invoke(null, world, x, y, data, (BiConsumer<NBTTagCompound, Throwable>) (nbt, exception) -> future.complete(nbt), true, priority);
|
||||||
|
return future;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized Supplier<NBTTagCompound> getLoadedChunk(CraftWorld world, int x, int z) {
|
||||||
|
if (!world.isChunkLoaded(x, z)) return () -> null;
|
||||||
|
Chunk c = world.getHandle().getChunkIfLoaded(x, z); //already safe async on vanilla
|
||||||
|
if ((c == null) || !c.q) return () -> null; // c.loaded
|
||||||
|
if (currTick != MinecraftServer.currentTick) {
|
||||||
|
currTick = MinecraftServer.currentTick;
|
||||||
|
currChunks = 0;
|
||||||
|
}
|
||||||
|
//prepare data synchronously
|
||||||
|
CompletableFuture<?> future = CompletableFuture.supplyAsync(() -> {
|
||||||
|
//Null will mean that we save with spigot methods, which may be risky on async
|
||||||
|
//Since we're not in main thread, it now refuses new tasks because of shutdown, the risk is lower
|
||||||
|
if (!Bukkit.isPrimaryThread()) return null;
|
||||||
|
try {
|
||||||
|
return getAsyncSaveData.invoke(null, world.getHandle(), c);
|
||||||
|
} catch (ReflectiveOperationException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}, ((CraftServer) Bukkit.getServer()).getServer());
|
||||||
|
//we shouldn't stress main thread
|
||||||
|
if (++currChunks > MapManager.mapman.getMaxChunkLoadsPerTick()) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(25); //hold the lock so other threads also won't stress main thread
|
||||||
|
} catch (InterruptedException ignored) {}
|
||||||
|
}
|
||||||
|
//save data asynchronously
|
||||||
|
return () -> {
|
||||||
|
Object o = null;
|
||||||
|
try {
|
||||||
|
o = future.get();
|
||||||
|
return (NBTTagCompound) save.invoke(null, world.getHandle(), c, o);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
return null;
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
//We tried to use simple spigot methods at shutdown and failed, hopes for reading from disk
|
||||||
|
if (o == null) return null;
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (ReflectiveOperationException | ExecutionException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,467 @@
|
|||||||
|
package org.dynmap.bukkit.helper.v120;
|
||||||
|
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.craftbukkit.v1_20_R1.CraftChunk;
|
||||||
|
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
|
||||||
|
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.dynmap.DynmapChunk;
|
||||||
|
import org.dynmap.Log;
|
||||||
|
import org.dynmap.bukkit.helper.BukkitMaterial;
|
||||||
|
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
||||||
|
import org.dynmap.bukkit.helper.BukkitWorld;
|
||||||
|
import org.dynmap.bukkit.helper.BukkitVersionHelperGeneric.TexturesPayload;
|
||||||
|
import org.dynmap.bukkit.helper.v120.MapChunkCache119_4;
|
||||||
|
import org.dynmap.renderer.DynmapBlockState;
|
||||||
|
import org.dynmap.utils.MapChunkCache;
|
||||||
|
import org.dynmap.utils.Polygon;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.JsonParseException;
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import com.mojang.authlib.properties.Property;
|
||||||
|
import com.mojang.authlib.properties.PropertyMap;
|
||||||
|
|
||||||
|
import net.minecraft.core.RegistryBlockID;
|
||||||
|
import net.minecraft.core.RegistryBlocks;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.core.BlockPosition;
|
||||||
|
import net.minecraft.core.IRegistry;
|
||||||
|
import net.minecraft.nbt.NBTTagByteArray;
|
||||||
|
import net.minecraft.nbt.NBTTagByte;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagDouble;
|
||||||
|
import net.minecraft.nbt.NBTTagFloat;
|
||||||
|
import net.minecraft.nbt.NBTTagIntArray;
|
||||||
|
import net.minecraft.nbt.NBTTagInt;
|
||||||
|
import net.minecraft.nbt.NBTTagLong;
|
||||||
|
import net.minecraft.nbt.NBTTagShort;
|
||||||
|
import net.minecraft.nbt.NBTTagString;
|
||||||
|
import net.minecraft.resources.MinecraftKey;
|
||||||
|
import net.minecraft.nbt.NBTBase;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.world.level.BlockAccessAir;
|
||||||
|
import net.minecraft.world.level.biome.BiomeBase;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.BlockAir;
|
||||||
|
import net.minecraft.world.level.block.BlockFluids;
|
||||||
|
import net.minecraft.world.level.block.BlockLeaves;
|
||||||
|
import net.minecraft.world.level.block.BlockRotatable;
|
||||||
|
import net.minecraft.world.level.block.entity.TileEntity;
|
||||||
|
import net.minecraft.world.level.block.state.IBlockData;
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.IdentityHashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper for isolation of bukkit version specific issues
|
||||||
|
*/
|
||||||
|
public class BukkitVersionHelperSpigot120 extends BukkitVersionHelper {
|
||||||
|
private final boolean unsafeAsync;
|
||||||
|
|
||||||
|
public BukkitVersionHelperSpigot120() {
|
||||||
|
boolean unsafeAsync1;
|
||||||
|
try {
|
||||||
|
Class.forName("io.papermc.paper.chunk.system.io.RegionFileIOThread");
|
||||||
|
unsafeAsync1 = false;
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
unsafeAsync1 = true;
|
||||||
|
}
|
||||||
|
this.unsafeAsync = unsafeAsync1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUnsafeAsync() {
|
||||||
|
return unsafeAsync;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get block short name list
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String[] getBlockNames() {
|
||||||
|
RegistryBlockID<IBlockData> bsids = Block.o;
|
||||||
|
Block baseb = null;
|
||||||
|
Iterator<IBlockData> iter = bsids.iterator();
|
||||||
|
ArrayList<String> names = new ArrayList<String>();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
IBlockData bs = iter.next();
|
||||||
|
Block b = bs.b();
|
||||||
|
// If this is new block vs last, it's the base block state
|
||||||
|
if (b != baseb) {
|
||||||
|
baseb = b;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
MinecraftKey id = BuiltInRegistries.f.b(b);
|
||||||
|
String bn = id.toString();
|
||||||
|
if (bn != null) {
|
||||||
|
names.add(bn);
|
||||||
|
Log.info("block=" + bn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return names.toArray(new String[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IRegistry<BiomeBase> reg = null;
|
||||||
|
|
||||||
|
private static IRegistry<BiomeBase> getBiomeReg() {
|
||||||
|
if (reg == null) {
|
||||||
|
reg = MinecraftServer.getServer().aV().d(Registries.ap);
|
||||||
|
}
|
||||||
|
return reg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object[] biomelist;
|
||||||
|
/**
|
||||||
|
* Get list of defined biomebase objects
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Object[] getBiomeBaseList() {
|
||||||
|
if (biomelist == null) {
|
||||||
|
biomelist = new BiomeBase[256];
|
||||||
|
Iterator<BiomeBase> iter = getBiomeReg().iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
BiomeBase b = iter.next();
|
||||||
|
int bidx = getBiomeReg().a(b);
|
||||||
|
if (bidx >= biomelist.length) {
|
||||||
|
biomelist = Arrays.copyOf(biomelist, bidx + biomelist.length);
|
||||||
|
}
|
||||||
|
biomelist[bidx] = b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return biomelist;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get ID from biomebase */
|
||||||
|
@Override
|
||||||
|
public int getBiomeBaseID(Object bb) {
|
||||||
|
return getBiomeReg().a((BiomeBase)bb);
|
||||||
|
}
|
||||||
|
|
||||||
|
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>();
|
||||||
|
RegistryBlockID<IBlockData> bsids = Block.o;
|
||||||
|
Block baseb = null;
|
||||||
|
Iterator<IBlockData> iter = bsids.iterator();
|
||||||
|
ArrayList<String> names = new ArrayList<String>();
|
||||||
|
|
||||||
|
// Loop through block data states
|
||||||
|
DynmapBlockState.Builder bld = new DynmapBlockState.Builder();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
IBlockData bd = iter.next();
|
||||||
|
Block b = bd.b();
|
||||||
|
MinecraftKey id = BuiltInRegistries.f.b(b);
|
||||||
|
String bname = id.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);
|
||||||
|
}
|
||||||
|
int lightAtten = b.g(bd, BlockAccessAir.a, BlockPosition.b); // getLightBlock
|
||||||
|
//Log.info("statename=" + bname + "[" + sb + "], lightAtten=" + lightAtten);
|
||||||
|
// Fill in base attributes
|
||||||
|
bld.setBaseState(lastbs).setStateIndex(idx).setBlockName(bname).setStateName(sb).setMaterial(mat.toString()).setAttenuatesLight(lightAtten);
|
||||||
|
if (mat.b()) { bld.setSolid(); }
|
||||||
|
if (b instanceof BlockAir) { bld.setAir(); }
|
||||||
|
if (b instanceof BlockRotatable) { bld.setLog(); }
|
||||||
|
if (b instanceof BlockLeaves) { bld.setLeaves(); }
|
||||||
|
if ((!bd.r().c()) && ((bd.b() instanceof BlockFluids) == false)) { // Test if fluid type for block is not empty
|
||||||
|
bld.setWaterlogged();
|
||||||
|
}
|
||||||
|
DynmapBlockState dbs = bld.build(); // Build state
|
||||||
|
|
||||||
|
dataToState.put(bd, dbs);
|
||||||
|
lastBlockState.put(bname, (lastbs == null) ? dbs : lastbs);
|
||||||
|
Log.verboseinfo("blk=" + bname + ", idx=" + idx + ", state=" + sb + ", waterlogged=" + dbs.isWaterlogged());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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) {
|
||||||
|
MapChunkCache119_4 c = new MapChunkCache119_4(gencache);
|
||||||
|
c.setChunks(dw, chunks);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get biome base water multiplier
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int getBiomeBaseWaterMult(Object bb) {
|
||||||
|
BiomeBase biome = (BiomeBase) bb;
|
||||||
|
return biome.i(); // waterColor
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get temperature from biomebase */
|
||||||
|
@Override
|
||||||
|
public float getBiomeBaseTemperature(Object bb) {
|
||||||
|
return ((BiomeBase)bb).g();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get humidity from biomebase */
|
||||||
|
@Override
|
||||||
|
public float getBiomeBaseHumidity(Object bb) {
|
||||||
|
String vals = ((BiomeBase)bb).i.toString(); // Sleazy
|
||||||
|
float humidity = 0.5F;
|
||||||
|
int idx = vals.indexOf("downfall=");
|
||||||
|
if (idx >= 0) {
|
||||||
|
humidity = Float.parseFloat(vals.substring(idx+9, vals.indexOf(']', idx)));
|
||||||
|
}
|
||||||
|
return humidity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Polygon getWorldBorder(World world) {
|
||||||
|
Polygon p = null;
|
||||||
|
WorldBorder wb = world.getWorldBorder();
|
||||||
|
if (wb != null) {
|
||||||
|
Location c = wb.getCenter();
|
||||||
|
double size = wb.getSize();
|
||||||
|
if ((size > 1) && (size < 1E7)) {
|
||||||
|
size = size / 2;
|
||||||
|
p = new Polygon();
|
||||||
|
p.addVertex(c.getX()-size, c.getZ()-size);
|
||||||
|
p.addVertex(c.getX()+size, c.getZ()-size);
|
||||||
|
p.addVertex(c.getX()+size, c.getZ()+size);
|
||||||
|
p.addVertex(c.getX()-size, c.getZ()+size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
// Send title/subtitle to user
|
||||||
|
public void sendTitleText(Player p, String title, String subtitle, int fadeInTicks, int stayTicks, int fadeOutTIcks) {
|
||||||
|
if (p != null) {
|
||||||
|
p.sendTitle(title, subtitle, fadeInTicks, stayTicks, fadeOutTIcks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get material map by block ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BukkitMaterial[] getMaterialList() {
|
||||||
|
return new BukkitMaterial[4096]; // Not used
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unloadChunkNoSave(World w, org.bukkit.Chunk c, int cx, int cz) {
|
||||||
|
Log.severe("unloadChunkNoSave not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String[] biomenames;
|
||||||
|
@Override
|
||||||
|
public String[] getBiomeNames() {
|
||||||
|
if (biomenames == null) {
|
||||||
|
biomenames = new String[256];
|
||||||
|
Iterator<BiomeBase> iter = getBiomeReg().iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
BiomeBase b = iter.next();
|
||||||
|
int bidx = getBiomeReg().a(b);
|
||||||
|
if (bidx >= biomenames.length) {
|
||||||
|
biomenames = Arrays.copyOf(biomenames, bidx + biomenames.length);
|
||||||
|
}
|
||||||
|
biomenames[bidx] = b.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return biomenames;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getStateStringByCombinedId(int blkid, int meta) {
|
||||||
|
Log.severe("getStateStringByCombinedId not implemented");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
/** Get ID string from biomebase */
|
||||||
|
public String getBiomeBaseIDString(Object bb) {
|
||||||
|
return getBiomeReg().b((BiomeBase)bb).a();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String getBiomeBaseResourceLocsation(Object bb) {
|
||||||
|
return getBiomeReg().b((BiomeBase)bb).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getUnloadQueue(World world) {
|
||||||
|
Log.warning("getUnloadQueue not implemented yet");
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInUnloadQueue(Object unloadqueue, int x, int z) {
|
||||||
|
Log.warning("isInUnloadQueue not implemented yet");
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] getBiomeBaseFromSnapshot(ChunkSnapshot css) {
|
||||||
|
Log.warning("getBiomeBaseFromSnapshot not implemented yet");
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return new Object[256];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getInhabitedTicks(Chunk c) {
|
||||||
|
return ((CraftChunk)c).getHandle(ChunkStatus.o).u();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<?, ?> getTileEntitiesForChunk(Chunk c) {
|
||||||
|
return ((CraftChunk)c).getHandle(ChunkStatus.o).i;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTileEntityX(Object te) {
|
||||||
|
TileEntity tileent = (TileEntity) te;
|
||||||
|
return tileent.p().u();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTileEntityY(Object te) {
|
||||||
|
TileEntity tileent = (TileEntity) te;
|
||||||
|
return tileent.p().v();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTileEntityZ(Object te) {
|
||||||
|
TileEntity tileent = (TileEntity) te;
|
||||||
|
return tileent.p().w();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object readTileEntityNBT(Object te) {
|
||||||
|
TileEntity tileent = (TileEntity) te;
|
||||||
|
NBTTagCompound nbt = tileent.n();
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getFieldValue(Object nbt, String field) {
|
||||||
|
NBTTagCompound rec = (NBTTagCompound) nbt;
|
||||||
|
NBTBase val = rec.c(field);
|
||||||
|
if(val == null) return null;
|
||||||
|
if(val instanceof NBTTagByte) {
|
||||||
|
return ((NBTTagByte)val).h();
|
||||||
|
}
|
||||||
|
else if(val instanceof NBTTagShort) {
|
||||||
|
return ((NBTTagShort)val).g();
|
||||||
|
}
|
||||||
|
else if(val instanceof NBTTagInt) {
|
||||||
|
return ((NBTTagInt)val).f();
|
||||||
|
}
|
||||||
|
else if(val instanceof NBTTagLong) {
|
||||||
|
return ((NBTTagLong)val).e();
|
||||||
|
}
|
||||||
|
else if(val instanceof NBTTagFloat) {
|
||||||
|
return ((NBTTagFloat)val).j();
|
||||||
|
}
|
||||||
|
else if(val instanceof NBTTagDouble) {
|
||||||
|
return ((NBTTagDouble)val).i();
|
||||||
|
}
|
||||||
|
else if(val instanceof NBTTagByteArray) {
|
||||||
|
return ((NBTTagByteArray)val).d();
|
||||||
|
}
|
||||||
|
else if(val instanceof NBTTagString) {
|
||||||
|
return ((NBTTagString)val).f_();
|
||||||
|
}
|
||||||
|
else if(val instanceof NBTTagIntArray) {
|
||||||
|
return ((NBTTagIntArray)val).f();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Player[] getOnlinePlayers() {
|
||||||
|
Collection<? extends Player> p = Bukkit.getServer().getOnlinePlayers();
|
||||||
|
return p.toArray(new Player[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getHealth(Player p) {
|
||||||
|
return p.getHealth();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Gson gson = new GsonBuilder().create();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get skin URL for player
|
||||||
|
* @param player
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getSkinURL(Player player) {
|
||||||
|
String url = null;
|
||||||
|
CraftPlayer cp = (CraftPlayer)player;
|
||||||
|
GameProfile profile = cp.getProfile();
|
||||||
|
if (profile != null) {
|
||||||
|
PropertyMap pm = profile.getProperties();
|
||||||
|
if (pm != null) {
|
||||||
|
Collection<Property> txt = pm.get("textures");
|
||||||
|
Property textureProperty = Iterables.getFirst(pm.get("textures"), null);
|
||||||
|
if (textureProperty != null) {
|
||||||
|
String val = textureProperty.getValue();
|
||||||
|
if (val != null) {
|
||||||
|
TexturesPayload result = null;
|
||||||
|
try {
|
||||||
|
String json = new String(Base64.getDecoder().decode(val), StandardCharsets.UTF_8);
|
||||||
|
result = gson.fromJson(json, TexturesPayload.class);
|
||||||
|
} catch (JsonParseException e) {
|
||||||
|
} catch (IllegalArgumentException x) {
|
||||||
|
Log.warning("Malformed response from skin URL check: " + val);
|
||||||
|
}
|
||||||
|
if ((result != null) && (result.textures != null) && (result.textures.containsKey("SKIN"))) {
|
||||||
|
url = result.textures.get("SKIN").url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
// Get minY for world
|
||||||
|
@Override
|
||||||
|
public int getWorldMinY(World w) {
|
||||||
|
CraftWorld cw = (CraftWorld) w;
|
||||||
|
return cw.getMinHeight();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean useGenericCache() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,114 @@
|
|||||||
|
package org.dynmap.bukkit.helper.v120;
|
||||||
|
|
||||||
|
import net.minecraft.world.level.biome.BiomeBase;
|
||||||
|
import net.minecraft.world.level.biome.BiomeFog;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;
|
||||||
|
import org.dynmap.DynmapChunk;
|
||||||
|
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
||||||
|
import org.dynmap.bukkit.helper.BukkitWorld;
|
||||||
|
import org.dynmap.bukkit.helper.v120.AsyncChunkProvider120;
|
||||||
|
import org.dynmap.bukkit.helper.v120.NBT;
|
||||||
|
import org.dynmap.common.BiomeMap;
|
||||||
|
import org.dynmap.common.chunk.GenericChunk;
|
||||||
|
import org.dynmap.common.chunk.GenericChunkCache;
|
||||||
|
import org.dynmap.common.chunk.GenericMapChunkCache;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.level.ChunkCoordIntPair;
|
||||||
|
import net.minecraft.world.level.chunk.storage.ChunkRegionLoader;
|
||||||
|
import net.minecraft.world.level.chunk.Chunk;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
|
import java.util.concurrent.CancellationException;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Container for managing chunks - dependent upon using chunk snapshots, since rendering is off server thread
|
||||||
|
*/
|
||||||
|
public class MapChunkCache119_4 extends GenericMapChunkCache {
|
||||||
|
private static final AsyncChunkProvider120 provider = BukkitVersionHelper.helper.isUnsafeAsync() ? null : new AsyncChunkProvider120();
|
||||||
|
private World w;
|
||||||
|
/**
|
||||||
|
* Construct empty cache
|
||||||
|
*/
|
||||||
|
public MapChunkCache119_4(GenericChunkCache cc) {
|
||||||
|
super(cc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load generic chunk from existing and already loaded chunk
|
||||||
|
@Override
|
||||||
|
protected Supplier<GenericChunk> getLoadedChunkAsync(DynmapChunk chunk) {
|
||||||
|
Supplier<NBTTagCompound> supplier = provider.getLoadedChunk((CraftWorld) w, chunk.x, chunk.z);
|
||||||
|
return () -> {
|
||||||
|
NBTTagCompound nbt = supplier.get();
|
||||||
|
return nbt != null ? parseChunkFromNBT(new NBT.NBTCompound(nbt)) : null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
|
||||||
|
CraftWorld cw = (CraftWorld) w;
|
||||||
|
if (!cw.isChunkLoaded(chunk.x, chunk.z)) return null;
|
||||||
|
Chunk c = cw.getHandle().getChunkIfLoaded(chunk.x, chunk.z);
|
||||||
|
if (c == null || !c.o) return null; // c.loaded
|
||||||
|
NBTTagCompound nbt = ChunkRegionLoader.a(cw.getHandle(), c);
|
||||||
|
return nbt != null ? parseChunkFromNBT(new NBT.NBTCompound(nbt)) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load generic chunk from unloaded chunk
|
||||||
|
@Override
|
||||||
|
protected Supplier<GenericChunk> loadChunkAsync(DynmapChunk chunk){
|
||||||
|
try {
|
||||||
|
CompletableFuture<NBTTagCompound> nbt = provider.getChunk(((CraftWorld) w).getHandle(), chunk.x, chunk.z);
|
||||||
|
return () -> {
|
||||||
|
NBTTagCompound compound;
|
||||||
|
try {
|
||||||
|
compound = nbt.get();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
return null;
|
||||||
|
} catch (ExecutionException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return compound == null ? null : parseChunkFromNBT(new NBT.NBTCompound(compound));
|
||||||
|
};
|
||||||
|
} catch (InvocationTargetException | IllegalAccessException ignored) {
|
||||||
|
return () -> null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected GenericChunk loadChunk(DynmapChunk chunk) {
|
||||||
|
CraftWorld cw = (CraftWorld) w;
|
||||||
|
NBTTagCompound nbt = null;
|
||||||
|
ChunkCoordIntPair cc = new ChunkCoordIntPair(chunk.x, chunk.z);
|
||||||
|
GenericChunk gc = null;
|
||||||
|
try { // BUGBUG - convert this all to asyn properly, since now native async
|
||||||
|
nbt = cw.getHandle().k().a.f(cc).join().get(); // playerChunkMap
|
||||||
|
} catch (CancellationException cx) {
|
||||||
|
} catch (NoSuchElementException snex) {
|
||||||
|
}
|
||||||
|
if (nbt != null) {
|
||||||
|
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
|
||||||
|
}
|
||||||
|
return gc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChunks(BukkitWorld dw, List<DynmapChunk> chunks) {
|
||||||
|
this.w = dw.getWorld();
|
||||||
|
super.setChunks(dw, chunks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFoliageColor(BiomeMap bm, int[] colormap, int x, int z) {
|
||||||
|
return bm.<BiomeBase>getBiomeObject().map(BiomeBase::h).flatMap(BiomeFog::e).orElse(colormap[bm.biomeLookup()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getGrassColor(BiomeMap bm, int[] colormap, int x, int z) {
|
||||||
|
BiomeFog fog = bm.<BiomeBase>getBiomeObject().map(BiomeBase::h).orElse(null);
|
||||||
|
if (fog == null) return colormap[bm.biomeLookup()];
|
||||||
|
return fog.g().a(x, z, fog.f().orElse(colormap[bm.biomeLookup()]));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,126 @@
|
|||||||
|
package org.dynmap.bukkit.helper.v120;
|
||||||
|
|
||||||
|
import org.dynmap.common.chunk.GenericBitStorage;
|
||||||
|
import org.dynmap.common.chunk.GenericNBTCompound;
|
||||||
|
import org.dynmap.common.chunk.GenericNBTList;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.util.SimpleBitStorage;
|
||||||
|
|
||||||
|
public class NBT {
|
||||||
|
|
||||||
|
public static class NBTCompound implements GenericNBTCompound {
|
||||||
|
private final NBTTagCompound obj;
|
||||||
|
public NBTCompound(NBTTagCompound t) {
|
||||||
|
this.obj = t;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Set<String> getAllKeys() {
|
||||||
|
return obj.e();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean contains(String s) {
|
||||||
|
return obj.e(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean contains(String s, int i) {
|
||||||
|
return obj.b(s, i);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public byte getByte(String s) {
|
||||||
|
return obj.f(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public short getShort(String s) {
|
||||||
|
return obj.g(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getInt(String s) {
|
||||||
|
return obj.h(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public long getLong(String s) {
|
||||||
|
return obj.i(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public float getFloat(String s) {
|
||||||
|
return obj.j(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public double getDouble(String s) {
|
||||||
|
return obj.k(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String getString(String s) {
|
||||||
|
return obj.l(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public byte[] getByteArray(String s) {
|
||||||
|
return obj.m(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int[] getIntArray(String s) {
|
||||||
|
return obj.n(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public long[] getLongArray(String s) {
|
||||||
|
return obj.o(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public GenericNBTCompound getCompound(String s) {
|
||||||
|
return new NBTCompound(obj.p(s));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public GenericNBTList getList(String s, int i) {
|
||||||
|
return new NBTList(obj.c(s, i));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean getBoolean(String s) {
|
||||||
|
return obj.q(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String getAsString(String s) {
|
||||||
|
return obj.c(s).f_();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public GenericBitStorage makeBitStorage(int bits, int count, long[] data) {
|
||||||
|
return new OurBitStorage(bits, count, data);
|
||||||
|
}
|
||||||
|
public String toString() {
|
||||||
|
return obj.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class NBTList implements GenericNBTList {
|
||||||
|
private final NBTTagList obj;
|
||||||
|
public NBTList(NBTTagList t) {
|
||||||
|
obj = t;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int size() {
|
||||||
|
return obj.size();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String getString(int idx) {
|
||||||
|
return obj.j(idx);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public GenericNBTCompound getCompound(int idx) {
|
||||||
|
return new NBTCompound(obj.a(idx));
|
||||||
|
}
|
||||||
|
public String toString() {
|
||||||
|
return obj.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class OurBitStorage implements GenericBitStorage {
|
||||||
|
private final SimpleBitStorage bs;
|
||||||
|
public OurBitStorage(int bits, int count, long[] data) {
|
||||||
|
bs = new SimpleBitStorage(bits, count, data);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int get(int idx) {
|
||||||
|
return bs.a(idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,35 +2,38 @@
|
|||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>Dynmap(Spigot-Common)</name>
|
<name>Dynmap(Spigot-Common)</name>
|
||||||
<comment>bukkit-helper</comment>
|
<comment>bukkit-helper</comment>
|
||||||
<projects/>
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments/>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
||||||
<arguments/>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments/>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<linkedResources/>
|
|
||||||
<filteredResources>
|
<filteredResources>
|
||||||
<filter>
|
<filter>
|
||||||
<id>1</id>
|
<id>1</id>
|
||||||
|
<name></name>
|
||||||
<type>30</type>
|
<type>30</type>
|
||||||
<name/>
|
|
||||||
<matcher>
|
<matcher>
|
||||||
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||||
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||||
</matcher>
|
</matcher>
|
||||||
</filter>
|
</filter>
|
||||||
</filteredResources>
|
</filteredResources>
|
||||||
|
@ -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=../bukkit-helper-119-4
|
connection.project.dir=..
|
||||||
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,9 +1,14 @@
|
|||||||
#
|
|
||||||
#Wed May 10 08:52:08 CDT 2023
|
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
BIN
forge-1.20/.DS_Store
vendored
Normal file
BIN
forge-1.20/.DS_Store
vendored
Normal file
Binary file not shown.
1
forge-1.20/.gitignore
vendored
Normal file
1
forge-1.20/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/build/
|
2
forge-1.20/bin/.gitignore
vendored
Normal file
2
forge-1.20/bin/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/main/
|
||||||
|
/test/
|
92
forge-1.20/build.gradle
Normal file
92
forge-1.20/build.gradle
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
maven { url = 'https://files.minecraftforge.net/maven' }
|
||||||
|
jcenter()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
apply plugin: 'net.minecraftforge.gradle'
|
||||||
|
apply plugin: 'com.github.johnrengelman.shadow'
|
||||||
|
apply plugin: 'eclipse'
|
||||||
|
|
||||||
|
eclipse {
|
||||||
|
project {
|
||||||
|
name = "Dynmap(Forge-1.20)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaLanguageVersion.of(17) // Need this here so eclipse task generates correctly.
|
||||||
|
|
||||||
|
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
||||||
|
|
||||||
|
ext.buildNumber = System.getenv().BUILD_NUMBER ?: "Dev"
|
||||||
|
|
||||||
|
minecraft {
|
||||||
|
mappings channel: 'official', version: '1.20'
|
||||||
|
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
|
runs {
|
||||||
|
server {
|
||||||
|
workingDirectory project.file('run').canonicalPath
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project.archivesBaseName = "${project.archivesBaseName}-forge-1.19.3"
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(path: ":DynmapCore", configuration: "shadow")
|
||||||
|
implementation project(path: ':DynmapCoreAPI')
|
||||||
|
|
||||||
|
minecraft 'net.minecraftforge:forge:1.20-46.0.1'
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources
|
||||||
|
{
|
||||||
|
filesMatching('META-INF/mods.toml') {
|
||||||
|
// replace version and mcversion
|
||||||
|
expand(
|
||||||
|
version: project.version + '-' + project.ext.buildNumber,
|
||||||
|
mcversion: "1.20"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shadowJar {
|
||||||
|
dependencies {
|
||||||
|
include(dependency(':DynmapCore'))
|
||||||
|
include(dependency("commons-codec:commons-codec:"))
|
||||||
|
exclude("META-INF/maven/**")
|
||||||
|
exclude("META-INF/services/**")
|
||||||
|
}
|
||||||
|
relocate('org.apache.commons.codec', 'org.dynmap.forge_1_20.commons.codec')
|
||||||
|
|
||||||
|
archiveName = "Dynmap-${parent.version}-forge-1.20.jar"
|
||||||
|
destinationDir = file '../target'
|
||||||
|
}
|
||||||
|
|
||||||
|
shadowJar.doLast {
|
||||||
|
task ->
|
||||||
|
ant.checksum file: task.archivePath
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
reobf {
|
||||||
|
shadowJar {
|
||||||
|
mappings = createMcpToSrg.output
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task deobfJar(type: Jar) {
|
||||||
|
from sourceSets.main.output
|
||||||
|
classifier = 'dev'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives deobfJar
|
||||||
|
}
|
||||||
|
|
||||||
|
build.dependsOn(shadowJar)
|
@ -0,0 +1,6 @@
|
|||||||
|
package org.dynmap.forge_1_20;
|
||||||
|
|
||||||
|
public class ClientProxy extends Proxy {
|
||||||
|
public ClientProxy() {
|
||||||
|
}
|
||||||
|
}
|
136
forge-1.20/src/main/java/org/dynmap/forge_1_20/DynmapMod.java
Normal file
136
forge-1.20/src/main/java/org/dynmap/forge_1_20/DynmapMod.java
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
package org.dynmap.forge_1_20;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
import org.dynmap.DynmapCommonAPI;
|
||||||
|
import org.dynmap.DynmapCommonAPIListener;
|
||||||
|
import org.dynmap.Log;
|
||||||
|
import org.dynmap.forge_1_20.DynmapPlugin.OurLog;
|
||||||
|
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.server.ServerAboutToStartEvent;
|
||||||
|
import net.minecraftforge.event.server.ServerStartedEvent;
|
||||||
|
import net.minecraftforge.event.server.ServerStartingEvent;
|
||||||
|
import net.minecraftforge.event.server.ServerStoppingEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
import net.minecraftforge.fml.IExtensionPoint;
|
||||||
|
import net.minecraftforge.fml.ModList;
|
||||||
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
|
import net.minecraftforge.fml.StartupMessageManager;
|
||||||
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
|
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
|
||||||
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
|
import net.minecraftforge.network.NetworkConstants;;
|
||||||
|
|
||||||
|
@Mod("dynmap")
|
||||||
|
public class DynmapMod
|
||||||
|
{
|
||||||
|
// The instance of your mod that Forge uses.
|
||||||
|
public static DynmapMod instance;
|
||||||
|
|
||||||
|
// Says where the client and server 'proxy' code is loaded.
|
||||||
|
public static Proxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> Proxy::new);
|
||||||
|
|
||||||
|
public static DynmapPlugin plugin;
|
||||||
|
public static File jarfile;
|
||||||
|
public static String ver;
|
||||||
|
public static boolean useforcedchunks;
|
||||||
|
|
||||||
|
public class APICallback extends DynmapCommonAPIListener {
|
||||||
|
@Override
|
||||||
|
public void apiListenerAdded() {
|
||||||
|
if(plugin == null) {
|
||||||
|
plugin = proxy.startServer(server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void apiEnabled(DynmapCommonAPI api) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO
|
||||||
|
//public class LoadingCallback implements net.minecraftforge.common.ForgeChunkManager.LoadingCallback {
|
||||||
|
// @Override
|
||||||
|
// public void ticketsLoaded(List<Ticket> tickets, World world) {
|
||||||
|
// if(tickets.size() > 0) {
|
||||||
|
// DynmapPlugin.setBusy(world, tickets.get(0));
|
||||||
|
// for(int i = 1; i < tickets.size(); i++) {
|
||||||
|
// ForgeChunkManager.releaseTicket(tickets.get(i));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
public DynmapMod() {
|
||||||
|
instance = this;
|
||||||
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
|
||||||
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init);
|
||||||
|
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
|
||||||
|
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class,
|
||||||
|
()->new IExtensionPoint.DisplayTest(()->NetworkConstants.IGNORESERVERONLY, (remote, isServer)-> true));
|
||||||
|
|
||||||
|
Log.setLogger(new OurLog());
|
||||||
|
org.dynmap.modsupport.ModSupportImpl.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setup(final FMLCommonSetupEvent event)
|
||||||
|
{
|
||||||
|
//TOOO
|
||||||
|
jarfile = ModList.get().getModFileById("dynmap").getFile().getFilePath().toFile();
|
||||||
|
|
||||||
|
ver = ModList.get().getModContainerById("dynmap").get().getModInfo().getVersion().toString();
|
||||||
|
|
||||||
|
//// Load configuration file - use suggested (config/WesterosBlocks.cfg)
|
||||||
|
//Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
|
||||||
|
//try {
|
||||||
|
// cfg.load();
|
||||||
|
//
|
||||||
|
// useforcedchunks = cfg.get("Settings", "UseForcedChunks", true).getBoolean(true);
|
||||||
|
//}
|
||||||
|
//finally
|
||||||
|
//{
|
||||||
|
// cfg.save();
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(FMLLoadCompleteEvent event)
|
||||||
|
{
|
||||||
|
/* Set up for chunk loading notice from chunk manager */
|
||||||
|
//TODO
|
||||||
|
//if(useforcedchunks) {
|
||||||
|
// ForgeChunkManager.setForcedChunkLoadingCallback(DynmapMod.instance, new LoadingCallback());
|
||||||
|
//}
|
||||||
|
//else {
|
||||||
|
// Log.info("[Dynmap] World loading using forced chunks is disabled");
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
private MinecraftServer server;
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onServerStarting(ServerAboutToStartEvent event) {
|
||||||
|
server = event.getServer();
|
||||||
|
if(plugin == null)
|
||||||
|
plugin = proxy.startServer(server);
|
||||||
|
plugin.onStarting(server.getCommands().getDispatcher());
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onServerStarted(ServerStartedEvent event) {
|
||||||
|
DynmapCommonAPIListener.register(new APICallback());
|
||||||
|
plugin.serverStarted();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void serverStopping(ServerStoppingEvent event)
|
||||||
|
{
|
||||||
|
proxy.stopServer(plugin);
|
||||||
|
plugin = null;
|
||||||
|
}
|
||||||
|
}
|
2035
forge-1.20/src/main/java/org/dynmap/forge_1_20/DynmapPlugin.java
Normal file
2035
forge-1.20/src/main/java/org/dynmap/forge_1_20/DynmapPlugin.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,109 @@
|
|||||||
|
package org.dynmap.forge_1_20;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
|
import net.minecraft.world.level.biome.Biome;
|
||||||
|
import net.minecraft.world.level.biome.BiomeSpecialEffects;
|
||||||
|
import org.dynmap.DynmapChunk;
|
||||||
|
import org.dynmap.Log;
|
||||||
|
import org.dynmap.common.BiomeMap;
|
||||||
|
import org.dynmap.common.chunk.GenericChunk;
|
||||||
|
import org.dynmap.common.chunk.GenericChunkCache;
|
||||||
|
import org.dynmap.common.chunk.GenericMapChunkCache;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.server.level.ServerChunkCache;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.level.ChunkPos;
|
||||||
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
|
import net.minecraft.world.level.chunk.storage.ChunkSerializer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Container for managing chunks - dependent upon using chunk snapshots, since
|
||||||
|
* rendering is off server thread
|
||||||
|
*/
|
||||||
|
public class ForgeMapChunkCache extends GenericMapChunkCache {
|
||||||
|
private ServerLevel w;
|
||||||
|
private ServerChunkCache cps;
|
||||||
|
/**
|
||||||
|
* Construct empty cache
|
||||||
|
*/
|
||||||
|
public ForgeMapChunkCache(GenericChunkCache cc) {
|
||||||
|
super(cc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load generic chunk from existing and already loaded chunk
|
||||||
|
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
|
||||||
|
GenericChunk gc = null;
|
||||||
|
ChunkAccess ch = cps.getChunk(chunk.x, chunk.z, ChunkStatus.FULL, false);
|
||||||
|
if (ch != null) {
|
||||||
|
CompoundTag nbt = ChunkSerializer.write(w, ch);
|
||||||
|
if (nbt != null) {
|
||||||
|
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return gc;
|
||||||
|
}
|
||||||
|
// Load generic chunk from unloaded chunk
|
||||||
|
protected GenericChunk loadChunk(DynmapChunk chunk) {
|
||||||
|
GenericChunk gc = null;
|
||||||
|
CompoundTag nbt = readChunk(chunk.x, chunk.z);
|
||||||
|
// If read was good
|
||||||
|
if (nbt != null) {
|
||||||
|
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
|
||||||
|
}
|
||||||
|
return gc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChunks(ForgeWorld dw, List<DynmapChunk> chunks) {
|
||||||
|
this.w = dw.getWorld();
|
||||||
|
if (dw.isLoaded()) {
|
||||||
|
/* Check if world's provider is ServerChunkProvider */
|
||||||
|
cps = this.w.getChunkSource();
|
||||||
|
}
|
||||||
|
super.setChunks(dw, chunks);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CompoundTag readChunk(int x, int z) {
|
||||||
|
try {
|
||||||
|
CompoundTag rslt = cps.chunkMap.read(new ChunkPos(x, z)).join().get();
|
||||||
|
if (rslt != null) {
|
||||||
|
CompoundTag lev = rslt;
|
||||||
|
if (lev.contains("Level")) {
|
||||||
|
lev = lev.getCompound("Level");
|
||||||
|
}
|
||||||
|
// Don't load uncooked chunks
|
||||||
|
String stat = lev.getString("Status");
|
||||||
|
ChunkStatus cs = ChunkStatus.byName(stat);
|
||||||
|
if ((stat == null) ||
|
||||||
|
// Needs to be at least lighted
|
||||||
|
(!cs.isOrAfter(ChunkStatus.LIGHT))) {
|
||||||
|
rslt = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Log.info(String.format("loadChunk(%d,%d)=%s", x, z, (rslt != null) ?
|
||||||
|
// rslt.toString() : "null"));
|
||||||
|
return rslt;
|
||||||
|
} catch (NoSuchElementException nsex) {
|
||||||
|
return null;
|
||||||
|
} catch (Exception exc) {
|
||||||
|
Log.severe(String.format("Error reading chunk: %s,%d,%d", dw.getName(), x, z), exc);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getFoliageColor(BiomeMap bm, int[] colormap, int x, int z) {
|
||||||
|
return bm.<Biome>getBiomeObject().map(Biome::getSpecialEffects)
|
||||||
|
.flatMap(BiomeSpecialEffects::getFoliageColorOverride)
|
||||||
|
.orElse(colormap[bm.biomeLookup()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getGrassColor(BiomeMap bm, int[] colormap, int x, int z) {
|
||||||
|
BiomeSpecialEffects effects = bm.<Biome>getBiomeObject().map(Biome::getSpecialEffects).orElse(null);
|
||||||
|
if (effects == null) return colormap[bm.biomeLookup()];
|
||||||
|
return effects.getGrassColorModifier().modifyColor(x, z, effects.getGrassColorOverride().orElse(colormap[bm.biomeLookup()]));
|
||||||
|
}
|
||||||
|
}
|
249
forge-1.20/src/main/java/org/dynmap/forge_1_20/ForgeWorld.java
Normal file
249
forge-1.20/src/main/java/org/dynmap/forge_1_20/ForgeWorld.java
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
package org.dynmap.forge_1_20;
|
||||||
|
/**
|
||||||
|
* Forge specific implementation of DynmapWorld
|
||||||
|
*/
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.world.level.ServerLevelAccessor;
|
||||||
|
import net.minecraft.world.level.border.WorldBorder;
|
||||||
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.LightLayer;
|
||||||
|
|
||||||
|
import org.dynmap.DynmapChunk;
|
||||||
|
import org.dynmap.DynmapLocation;
|
||||||
|
import org.dynmap.DynmapWorld;
|
||||||
|
import org.dynmap.utils.MapChunkCache;
|
||||||
|
import org.dynmap.utils.Polygon;
|
||||||
|
|
||||||
|
public class ForgeWorld extends DynmapWorld
|
||||||
|
{
|
||||||
|
private ServerLevelAccessor world;
|
||||||
|
private final boolean skylight;
|
||||||
|
private final boolean isnether;
|
||||||
|
private final boolean istheend;
|
||||||
|
private final String env;
|
||||||
|
private DynmapLocation spawnloc = new DynmapLocation();
|
||||||
|
private static int maxWorldHeight = 320; // Maximum allows world height
|
||||||
|
|
||||||
|
public static int getMaxWorldHeight() {
|
||||||
|
return maxWorldHeight;
|
||||||
|
}
|
||||||
|
public static void setMaxWorldHeight(int h) {
|
||||||
|
maxWorldHeight = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getWorldName(ServerLevelAccessor w) {
|
||||||
|
ResourceKey<Level> rk = w.getLevel().dimension();
|
||||||
|
String id = rk.location().getNamespace() + "_" + rk.location().getPath();
|
||||||
|
if (id.equals("minecraft_overworld")) { // Overworld?
|
||||||
|
return w.getLevel().serverLevelData.getLevelName();
|
||||||
|
}
|
||||||
|
else if (id.equals("minecraft_the_end")) {
|
||||||
|
return "DIM1";
|
||||||
|
}
|
||||||
|
else if (id.equals("minecraft_the_nether")) {
|
||||||
|
return "DIM-1";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateWorld(ServerLevelAccessor w) {
|
||||||
|
this.updateWorldHeights(w.getLevel().getHeight(), w.getLevel().dimensionType().minY(), w.getLevel().getSeaLevel());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ForgeWorld(ServerLevelAccessor w)
|
||||||
|
{
|
||||||
|
this(getWorldName(w),
|
||||||
|
w.getLevel().getHeight(),
|
||||||
|
w.getLevel().getSeaLevel(),
|
||||||
|
w.getLevel().dimension() == Level.NETHER,
|
||||||
|
w.getLevel().dimension() == Level.END,
|
||||||
|
getWorldName(w),
|
||||||
|
w.getLevel().dimensionType().minY());
|
||||||
|
setWorldLoaded(w);
|
||||||
|
}
|
||||||
|
public ForgeWorld(String name, int height, int sealevel, boolean nether, boolean the_end, String deftitle, int miny)
|
||||||
|
{
|
||||||
|
super(name, (height > maxWorldHeight)?maxWorldHeight:height, sealevel, miny);
|
||||||
|
world = null;
|
||||||
|
setTitle(deftitle);
|
||||||
|
isnether = nether;
|
||||||
|
istheend = the_end;
|
||||||
|
skylight = !(isnether || istheend);
|
||||||
|
|
||||||
|
if (isnether)
|
||||||
|
{
|
||||||
|
env = "nether";
|
||||||
|
}
|
||||||
|
else if (istheend)
|
||||||
|
{
|
||||||
|
env = "the_end";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
env = "normal";
|
||||||
|
}
|
||||||
|
//Log.info(getName() + ": skylight=" + skylight + ", height=" + this.worldheight + ", isnether=" + isnether + ", istheend=" + istheend);
|
||||||
|
}
|
||||||
|
/* Test if world is nether */
|
||||||
|
@Override
|
||||||
|
public boolean isNether()
|
||||||
|
{
|
||||||
|
return isnether;
|
||||||
|
}
|
||||||
|
public boolean isTheEnd()
|
||||||
|
{
|
||||||
|
return istheend;
|
||||||
|
}
|
||||||
|
/* Get world spawn location */
|
||||||
|
@Override
|
||||||
|
public DynmapLocation getSpawnLocation()
|
||||||
|
{
|
||||||
|
if(world != null) {
|
||||||
|
BlockPos p = world.getLevel().getSharedSpawnPos();
|
||||||
|
spawnloc.x = p.getX();
|
||||||
|
spawnloc.y = p.getY();
|
||||||
|
spawnloc.z = p.getZ();
|
||||||
|
spawnloc.world = this.getName();
|
||||||
|
}
|
||||||
|
return spawnloc;
|
||||||
|
}
|
||||||
|
/* Get world time */
|
||||||
|
@Override
|
||||||
|
public long getTime()
|
||||||
|
{
|
||||||
|
if(world != null)
|
||||||
|
return world.getLevel().getDayTime();
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/* World is storming */
|
||||||
|
@Override
|
||||||
|
public boolean hasStorm()
|
||||||
|
{
|
||||||
|
if(world != null)
|
||||||
|
return world.getLevel().isRaining();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* World is thundering */
|
||||||
|
@Override
|
||||||
|
public boolean isThundering()
|
||||||
|
{
|
||||||
|
if(world != null)
|
||||||
|
return world.getLevel().isThundering();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* World is loaded */
|
||||||
|
@Override
|
||||||
|
public boolean isLoaded()
|
||||||
|
{
|
||||||
|
return (world != null);
|
||||||
|
}
|
||||||
|
/* Set world to unloaded */
|
||||||
|
@Override
|
||||||
|
public void setWorldUnloaded()
|
||||||
|
{
|
||||||
|
getSpawnLocation();
|
||||||
|
world = null;
|
||||||
|
}
|
||||||
|
/* Set world to loaded */
|
||||||
|
public void setWorldLoaded(ServerLevelAccessor w) {
|
||||||
|
world = w;
|
||||||
|
this.sealevel = w.getLevel().getSeaLevel(); // Read actual current sealevel from world
|
||||||
|
// Update lighting table
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
// Algorithm based on LightmapTextureManager.getBrightness()
|
||||||
|
// We can't call that method because it's client-only.
|
||||||
|
// This means the code below can stop being correct if Mojang ever
|
||||||
|
// updates the curve; in that case we should reflect the changes.
|
||||||
|
float value = (float) i / 15.0f;
|
||||||
|
float brightness = value / (4.0f - 3.0f * value);
|
||||||
|
this.setBrightnessTableEntry(i, brightness);
|
||||||
|
//Log.info(getName() + ": light " + i + " = " + light);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Get light level of block */
|
||||||
|
@Override
|
||||||
|
public int getLightLevel(int x, int y, int z)
|
||||||
|
{
|
||||||
|
if(world != null)
|
||||||
|
return world.getLevel().getLightEngine().getRawBrightness(new BlockPos(x, y, z), 0);
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/* Get highest Y coord of given location */
|
||||||
|
@Override
|
||||||
|
public int getHighestBlockYAt(int x, int z)
|
||||||
|
{
|
||||||
|
if(world != null) {
|
||||||
|
return world.getLevel().getChunk(x >> 4, z >> 4).getHeight(Heightmap.Types.MOTION_BLOCKING, x & 15, z & 15);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/* Test if sky light level is requestable */
|
||||||
|
@Override
|
||||||
|
public boolean canGetSkyLightLevel()
|
||||||
|
{
|
||||||
|
return skylight;
|
||||||
|
}
|
||||||
|
/* Return sky light level */
|
||||||
|
@Override
|
||||||
|
public int getSkyLightLevel(int x, int y, int z)
|
||||||
|
{
|
||||||
|
if(world != null) {
|
||||||
|
return world.getLevel().getBrightness(LightLayer.SKY, new BlockPos(x, y, z));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Get world environment ID (lower case - normal, the_end, nether)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getEnvironment()
|
||||||
|
{
|
||||||
|
return env;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Get map chunk cache for world
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public MapChunkCache getChunkCache(List<DynmapChunk> chunks)
|
||||||
|
{
|
||||||
|
if (world != null) {
|
||||||
|
ForgeMapChunkCache c = new ForgeMapChunkCache(DynmapPlugin.plugin.sscache);
|
||||||
|
c.setChunks(this, chunks);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerLevel getWorld()
|
||||||
|
{
|
||||||
|
return world.getLevel();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Polygon getWorldBorder() {
|
||||||
|
if (world != null) {
|
||||||
|
WorldBorder wb = world.getWorldBorder();
|
||||||
|
if ((wb != null) && (wb.getSize() < 5.9E7)) {
|
||||||
|
Polygon p = new Polygon();
|
||||||
|
p.addVertex(wb.getMinX(), wb.getMinZ());
|
||||||
|
p.addVertex(wb.getMinX(), wb.getMaxZ());
|
||||||
|
p.addVertex(wb.getMaxX(), wb.getMaxZ());
|
||||||
|
p.addVertex(wb.getMaxX(), wb.getMinZ());
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
126
forge-1.20/src/main/java/org/dynmap/forge_1_20/NBT.java
Normal file
126
forge-1.20/src/main/java/org/dynmap/forge_1_20/NBT.java
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
package org.dynmap.forge_1_20;
|
||||||
|
|
||||||
|
import org.dynmap.common.chunk.GenericBitStorage;
|
||||||
|
import org.dynmap.common.chunk.GenericNBTCompound;
|
||||||
|
import org.dynmap.common.chunk.GenericNBTList;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.ListTag;
|
||||||
|
import net.minecraft.util.SimpleBitStorage;
|
||||||
|
|
||||||
|
public class NBT {
|
||||||
|
|
||||||
|
public static class NBTCompound implements GenericNBTCompound {
|
||||||
|
private final CompoundTag obj;
|
||||||
|
public NBTCompound(CompoundTag t) {
|
||||||
|
this.obj = t;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Set<String> getAllKeys() {
|
||||||
|
return obj.getAllKeys();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean contains(String s) {
|
||||||
|
return obj.contains(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean contains(String s, int i) {
|
||||||
|
return obj.contains(s, i);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public byte getByte(String s) {
|
||||||
|
return obj.getByte(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public short getShort(String s) {
|
||||||
|
return obj.getShort(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getInt(String s) {
|
||||||
|
return obj.getInt(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public long getLong(String s) {
|
||||||
|
return obj.getLong(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public float getFloat(String s) {
|
||||||
|
return obj.getFloat(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public double getDouble(String s) {
|
||||||
|
return obj.getDouble(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String getString(String s) {
|
||||||
|
return obj.getString(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public byte[] getByteArray(String s) {
|
||||||
|
return obj.getByteArray(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int[] getIntArray(String s) {
|
||||||
|
return obj.getIntArray(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public long[] getLongArray(String s) {
|
||||||
|
return obj.getLongArray(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public GenericNBTCompound getCompound(String s) {
|
||||||
|
return new NBTCompound(obj.getCompound(s));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public GenericNBTList getList(String s, int i) {
|
||||||
|
return new NBTList(obj.getList(s, i));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean getBoolean(String s) {
|
||||||
|
return obj.getBoolean(s);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String getAsString(String s) {
|
||||||
|
return obj.get(s).getAsString();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public GenericBitStorage makeBitStorage(int bits, int count, long[] data) {
|
||||||
|
return new OurBitStorage(bits, count, data);
|
||||||
|
}
|
||||||
|
public String toString() {
|
||||||
|
return obj.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class NBTList implements GenericNBTList {
|
||||||
|
private final ListTag obj;
|
||||||
|
public NBTList(ListTag t) {
|
||||||
|
obj = t;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int size() {
|
||||||
|
return obj.size();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String getString(int idx) {
|
||||||
|
return obj.getString(idx);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public GenericNBTCompound getCompound(int idx) {
|
||||||
|
return new NBTCompound(obj.getCompound(idx));
|
||||||
|
}
|
||||||
|
public String toString() {
|
||||||
|
return obj.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class OurBitStorage implements GenericBitStorage {
|
||||||
|
private final SimpleBitStorage bs;
|
||||||
|
public OurBitStorage(int bits, int count, long[] data) {
|
||||||
|
bs = new SimpleBitStorage(bits, count, data);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int get(int idx) {
|
||||||
|
return bs.get(idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
forge-1.20/src/main/java/org/dynmap/forge_1_20/Proxy.java
Normal file
24
forge-1.20/src/main/java/org/dynmap/forge_1_20/Proxy.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package org.dynmap.forge_1_20;
|
||||||
|
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server side proxy - methods for creating and cleaning up plugin
|
||||||
|
*/
|
||||||
|
public class Proxy
|
||||||
|
{
|
||||||
|
public Proxy()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public DynmapPlugin startServer(MinecraftServer srv) {
|
||||||
|
DynmapPlugin plugin = DynmapPlugin.plugin;
|
||||||
|
if (plugin == null) {
|
||||||
|
plugin = new DynmapPlugin(srv);
|
||||||
|
plugin.onEnable();
|
||||||
|
}
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
public void stopServer(DynmapPlugin plugin) {
|
||||||
|
plugin.onDisable();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,97 @@
|
|||||||
|
package org.dynmap.forge_1_20;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.dynmap.DynmapCore;
|
||||||
|
import org.dynmap.Log;
|
||||||
|
|
||||||
|
public class VersionCheck {
|
||||||
|
private static final String VERSION_URL = "http://mikeprimm.com/dynmap/releases.php";
|
||||||
|
public static void runCheck(final DynmapCore core) {
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
doCheck(core);
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getReleaseVersion(String s) {
|
||||||
|
int index = s.lastIndexOf('-');
|
||||||
|
if(index < 0)
|
||||||
|
index = s.lastIndexOf('.');
|
||||||
|
if(index >= 0)
|
||||||
|
s = s.substring(0, index);
|
||||||
|
String[] split = s.split("\\.");
|
||||||
|
int v = 0;
|
||||||
|
try {
|
||||||
|
for(int i = 0; (i < split.length) && (i < 3); i++) {
|
||||||
|
v += Integer.parseInt(split[i]) << (8 * (2 - i));
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException nfx) {}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getBuildNumber(String s) {
|
||||||
|
int index = s.lastIndexOf('-');
|
||||||
|
if(index < 0)
|
||||||
|
index = s.lastIndexOf('.');
|
||||||
|
if(index >= 0)
|
||||||
|
s = s.substring(index+1);
|
||||||
|
try {
|
||||||
|
return Integer.parseInt(s);
|
||||||
|
} catch (NumberFormatException nfx) {
|
||||||
|
return 99999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void doCheck(DynmapCore core) {
|
||||||
|
String pluginver = core.getDynmapPluginVersion();
|
||||||
|
String platform = core.getDynmapPluginPlatform();
|
||||||
|
String platver = core.getDynmapPluginPlatformVersion();
|
||||||
|
if((pluginver == null) || (platform == null) || (platver == null))
|
||||||
|
return;
|
||||||
|
HttpURLConnection conn = null;
|
||||||
|
String loc = VERSION_URL;
|
||||||
|
int cur_ver = getReleaseVersion(pluginver);
|
||||||
|
int cur_bn = getBuildNumber(pluginver);
|
||||||
|
try {
|
||||||
|
while((loc != null) && (!loc.isEmpty())) {
|
||||||
|
URL url = new URL(loc);
|
||||||
|
conn = (HttpURLConnection) url.openConnection();
|
||||||
|
conn.setRequestProperty("User-Agent", "Dynmap (" + platform + "/" + platver + "/" + pluginver);
|
||||||
|
conn.connect();
|
||||||
|
loc = conn.getHeaderField("Location");
|
||||||
|
}
|
||||||
|
BufferedReader rdr = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||||
|
String line = null;
|
||||||
|
while((line = rdr.readLine()) != null) {
|
||||||
|
String[] split = line.split(":");
|
||||||
|
if(split.length < 4) continue;
|
||||||
|
/* If our platform and version, or wildcard platform version */
|
||||||
|
if(split[0].equals(platform) && (split[1].equals("*") || split[1].equals(platver))) {
|
||||||
|
int recommended_ver = getReleaseVersion(split[2]);
|
||||||
|
int recommended_bn = getBuildNumber(split[2]);
|
||||||
|
if((recommended_ver > cur_ver) || ((recommended_ver == cur_ver) && (recommended_bn > cur_bn))) { /* Newer recommended build */
|
||||||
|
Log.info("Version obsolete: new recommended version " + split[2] + " is available.");
|
||||||
|
}
|
||||||
|
else if(cur_ver > recommended_ver) { /* Running dev or prerelease? */
|
||||||
|
int prerel_ver = getReleaseVersion(split[3]);
|
||||||
|
int prerel_bn = getBuildNumber(split[3]);
|
||||||
|
if((prerel_ver > cur_ver) || ((prerel_ver == cur_ver) && (prerel_bn > cur_bn))) {
|
||||||
|
Log.info("Version obsolete: new prerelease version " + split[3] + " is available.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception x) {
|
||||||
|
Log.info("Error checking for latest version");
|
||||||
|
} finally {
|
||||||
|
if(conn != null) {
|
||||||
|
conn.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,103 @@
|
|||||||
|
package org.dynmap.forge_1_20.permissions;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.dynmap.ConfigurationNode;
|
||||||
|
import org.dynmap.Log;
|
||||||
|
import org.dynmap.forge_1_20.DynmapPlugin;
|
||||||
|
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
|
public class FilePermissions implements PermissionProvider {
|
||||||
|
private HashMap<String, Set<String>> perms;
|
||||||
|
private Set<String> defperms;
|
||||||
|
|
||||||
|
public static FilePermissions create() {
|
||||||
|
File f = new File("dynmap/permissions.yml");
|
||||||
|
if(!f.exists())
|
||||||
|
return null;
|
||||||
|
ConfigurationNode cfg = new ConfigurationNode(f);
|
||||||
|
cfg.load();
|
||||||
|
|
||||||
|
Log.info("Using permissions.yml for access control");
|
||||||
|
|
||||||
|
return new FilePermissions(cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private FilePermissions(ConfigurationNode cfg) {
|
||||||
|
perms = new HashMap<String,Set<String>>();
|
||||||
|
for(String k : cfg.keySet()) {
|
||||||
|
List<String> p = cfg.getStrings(k, null);
|
||||||
|
if(p != null) {
|
||||||
|
k = k.toLowerCase();
|
||||||
|
HashSet<String> pset = new HashSet<String>();
|
||||||
|
for(String perm : p) {
|
||||||
|
pset.add(perm.toLowerCase());
|
||||||
|
}
|
||||||
|
perms.put(k, pset);
|
||||||
|
if(k.equals("defaultuser")) {
|
||||||
|
defperms = pset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasPerm(String player, String perm) {
|
||||||
|
Set<String> ps = perms.get(player);
|
||||||
|
if((ps != null) && (ps.contains(perm))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(defperms.contains(perm)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Set<String> hasOfflinePermissions(String player, Set<String> perms) {
|
||||||
|
player = player.toLowerCase();
|
||||||
|
HashSet<String> rslt = new HashSet<String>();
|
||||||
|
if(DynmapPlugin.plugin.isOp(player)) {
|
||||||
|
rslt.addAll(perms);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for(String p : perms) {
|
||||||
|
if(hasPerm(player, p)) {
|
||||||
|
rslt.add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rslt;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean hasOfflinePermission(String player, String perm) {
|
||||||
|
player = player.toLowerCase();
|
||||||
|
if(DynmapPlugin.plugin.isOp(player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return hasPerm(player, perm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean has(ServerPlayer psender, String permission) {
|
||||||
|
if(psender != null) {
|
||||||
|
String n = psender.getName().getString().toLowerCase();
|
||||||
|
return hasPerm(n, permission);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean hasPermissionNode(ServerPlayer psender, String permission) {
|
||||||
|
if(psender != null) {
|
||||||
|
String player = psender.getName().getString().toLowerCase();
|
||||||
|
return DynmapPlugin.plugin.isOp(player);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package org.dynmap.forge_1_20.permissions;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.dynmap.Log;
|
||||||
|
import org.dynmap.forge_1_20.DynmapPlugin;
|
||||||
|
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
|
public class OpPermissions implements PermissionProvider {
|
||||||
|
public HashSet<String> usrCommands = new HashSet<String>();
|
||||||
|
|
||||||
|
public OpPermissions(String[] usrCommands) {
|
||||||
|
for (String usrCommand : usrCommands) {
|
||||||
|
this.usrCommands.add(usrCommand);
|
||||||
|
}
|
||||||
|
Log.info("Using ops.txt for access control");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> hasOfflinePermissions(String player, Set<String> perms) {
|
||||||
|
HashSet<String> rslt = new HashSet<String>();
|
||||||
|
if(DynmapPlugin.plugin.isOp(player)) {
|
||||||
|
rslt.addAll(perms);
|
||||||
|
}
|
||||||
|
return rslt;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean hasOfflinePermission(String player, String perm) {
|
||||||
|
return DynmapPlugin.plugin.isOp(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean has(ServerPlayer psender, String permission) {
|
||||||
|
if(psender != null) {
|
||||||
|
if(usrCommands.contains(permission)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return DynmapPlugin.plugin.isOp(psender.getName().getString());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean hasPermissionNode(ServerPlayer psender, String permission) {
|
||||||
|
if(psender != null) {
|
||||||
|
return DynmapPlugin.plugin.isOp(psender.getName().getString());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.dynmap.forge_1_20.permissions;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
|
public interface PermissionProvider {
|
||||||
|
boolean has(ServerPlayer sender, String permission);
|
||||||
|
boolean hasPermissionNode(ServerPlayer sender, String permission);
|
||||||
|
|
||||||
|
Set<String> hasOfflinePermissions(String player, Set<String> perms);
|
||||||
|
|
||||||
|
boolean hasOfflinePermission(String player, String perm);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
public net.minecraft.world.level.biome.BiomeSpecialEffects$Builder f_47928_ # waterColor
|
||||||
|
public net.minecraft.server.level.ServerLevel f_8549_ # serverLevelData
|
||||||
|
public net.minecraft.server.level.ChunkMap f_140130_ # visibleChunkMap
|
||||||
|
public net.minecraft.server.level.ChunkMap m_214963_(Lnet/minecraft/world/level/ChunkPos;)Ljava/util/concurrent/CompletableFuture; # readChunk(
|
26
forge-1.20/src/main/resources/META-INF/mods.toml
Normal file
26
forge-1.20/src/main/resources/META-INF/mods.toml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
modLoader="javafml"
|
||||||
|
loaderVersion="[46,)"
|
||||||
|
issueTrackerURL="https://github.com/webbukkit/dynmap/issues"
|
||||||
|
license="Apache Public License v2"
|
||||||
|
[[mods]]
|
||||||
|
modId="dynmap"
|
||||||
|
version="${version}"
|
||||||
|
displayName="Dynmap"
|
||||||
|
authors="mikeprimm"
|
||||||
|
description='''
|
||||||
|
Dynamic, Google-maps style rendered maps for your Minecraft server
|
||||||
|
'''
|
||||||
|
|
||||||
|
[[dependencies.dynmap]]
|
||||||
|
modId="forge"
|
||||||
|
mandatory=true
|
||||||
|
versionRange="[46,)"
|
||||||
|
ordering="NONE"
|
||||||
|
# Side this dependency is applied on - BOTH, CLIENT or SERVER
|
||||||
|
side="SERVER"
|
||||||
|
[[dependencies.dynmap]]
|
||||||
|
modId="minecraft"
|
||||||
|
mandatory=true
|
||||||
|
versionRange="[1.20,1.21)"
|
||||||
|
ordering="NONE"
|
||||||
|
side="SERVER"
|
497
forge-1.20/src/main/resources/configuration.txt
Normal file
497
forge-1.20/src/main/resources/configuration.txt
Normal file
@ -0,0 +1,497 @@
|
|||||||
|
# All paths in this configuration file are relative to Dynmap's data-folder: minecraft_server/dynmap/
|
||||||
|
|
||||||
|
# All map templates are defined in the templates directory
|
||||||
|
# To use the HDMap very-low-res (2 ppb) map templates as world defaults, set value to vlowres
|
||||||
|
# The definitions of these templates are in normal-vlowres.txt, nether-vlowres.txt, and the_end-vlowres.txt
|
||||||
|
# To use the HDMap low-res (4 ppb) map templates as world defaults, set value to lowres
|
||||||
|
# The definitions of these templates are in normal-lowres.txt, nether-lowres.txt, and the_end-lowres.txt
|
||||||
|
# To use the HDMap hi-res (16 ppb) map templates (these can take a VERY long time for initial fullrender), set value to hires
|
||||||
|
# The definitions of these templates are in normal-hires.txt, nether-hires.txt, and the_end-hires.txt
|
||||||
|
# To use the HDMap low-res (4 ppb) map templates, with support for boosting resolution selectively to hi-res (16 ppb), set value to low_boost_hi
|
||||||
|
# The definitions of these templates are in normal-low_boost_hi.txt, nether-low_boost_hi.txt, and the_end-low_boost_hi.txt
|
||||||
|
# To use the HDMap hi-res (16 ppb) map templates, with support for boosting resolution selectively to vhi-res (32 ppb), set value to hi_boost_vhi
|
||||||
|
# The definitions of these templates are in normal-hi_boost_vhi.txt, nether-hi_boost_vhi.txt, and the_end-hi_boost_vhi.txt
|
||||||
|
# To use the HDMap hi-res (16 ppb) map templates, with support for boosting resolution selectively to xhi-res (64 ppb), set value to hi_boost_xhi
|
||||||
|
# The definitions of these templates are in normal-hi_boost_xhi.txt, nether-hi_boost_xhi.txt, and the_end-hi_boost_xhi.txt
|
||||||
|
deftemplatesuffix: hires
|
||||||
|
|
||||||
|
# Set default tile scale (0 = 128px x 128x, 1 = 256px x 256px, 2 = 512px x 512px, 3 = 1024px x 1024px, 4 = 2048px x 2048px) - 0 is default
|
||||||
|
# Note: changing this value will result in all maps that use the default value being required to be fully rendered
|
||||||
|
#defaulttilescale: 0
|
||||||
|
|
||||||
|
# Map storage scheme: only uncommoent one 'type' value
|
||||||
|
# filetree: classic and default scheme: tree of files, with all map data under the directory indicated by 'tilespath' setting
|
||||||
|
# sqlite: single SQLite database file (this can get VERY BIG), located at 'dbfile' setting (default is file dynmap.db in data directory)
|
||||||
|
# mysql: MySQL database, at hostname:port in database, accessed via userid with password
|
||||||
|
# mariadb: MariaDB database, at hostname:port in database, accessed via userid with password
|
||||||
|
# postgres: PostgreSQL database, at hostname:port in database, accessed via userid with password
|
||||||
|
storage:
|
||||||
|
# Filetree storage (standard tree of image files for maps)
|
||||||
|
type: filetree
|
||||||
|
# SQLite db for map storage (uses dbfile as storage location)
|
||||||
|
#type: sqlite
|
||||||
|
#dbfile: dynmap.db
|
||||||
|
# MySQL DB for map storage (at 'hostname':'port' in database 'database' using user 'userid' password 'password' and table prefix 'prefix'
|
||||||
|
#type: mysql
|
||||||
|
#hostname: localhost
|
||||||
|
#port: 3306
|
||||||
|
#database: dynmap
|
||||||
|
#userid: dynmap
|
||||||
|
#password: dynmap
|
||||||
|
#prefix: ""
|
||||||
|
#
|
||||||
|
# AWS S3 backet web site
|
||||||
|
#type: aws_s3
|
||||||
|
#bucketname: "dynmap-bucket-name"
|
||||||
|
#region: us-east-1
|
||||||
|
#aws_access_key_id: "<aws-access-key-id>"
|
||||||
|
#aws_secret_access_key: "<aws-secret-access-key>"
|
||||||
|
#prefix: ""
|
||||||
|
|
||||||
|
components:
|
||||||
|
- class: org.dynmap.ClientConfigurationComponent
|
||||||
|
|
||||||
|
# Remember to change the following class to org.dynmap.JsonFileClientUpdateComponent when using an external web server.
|
||||||
|
- class: org.dynmap.InternalClientUpdateComponent
|
||||||
|
sendhealth: true
|
||||||
|
sendposition: true
|
||||||
|
allowwebchat: true
|
||||||
|
webchat-interval: 5
|
||||||
|
hidewebchatip: false
|
||||||
|
trustclientname: false
|
||||||
|
includehiddenplayers: false
|
||||||
|
# (optional) if true, color codes in player display names are used
|
||||||
|
use-name-colors: false
|
||||||
|
# (optional) if true, player login IDs will be used for web chat when their IPs match
|
||||||
|
use-player-login-ip: true
|
||||||
|
# (optional) if use-player-login-ip is true, setting this to true will cause chat messages not matching a known player IP to be ignored
|
||||||
|
require-player-login-ip: false
|
||||||
|
# (optional) block player login IDs that are banned from chatting
|
||||||
|
block-banned-player-chat: true
|
||||||
|
# Require login for web-to-server chat (requires login-enabled: true)
|
||||||
|
webchat-requires-login: false
|
||||||
|
# If set to true, users must have dynmap.webchat permission in order to chat
|
||||||
|
webchat-permissions: false
|
||||||
|
# Limit length of single chat messages
|
||||||
|
chatlengthlimit: 256
|
||||||
|
# # Optional - make players hidden when they are inside/underground/in shadows (#=light level: 0=full shadow,15=sky)
|
||||||
|
# hideifshadow: 4
|
||||||
|
# # Optional - make player hidden when they are under cover (#=sky light level,0=underground,15=open to sky)
|
||||||
|
# hideifundercover: 14
|
||||||
|
# # (Optional) if true, players that are crouching/sneaking will be hidden
|
||||||
|
hideifsneaking: false
|
||||||
|
# If true, player positions/status is protected (login with ID with dynmap.playermarkers.seeall permission required for info other than self)
|
||||||
|
protected-player-info: false
|
||||||
|
# If true, hide players with invisibility potion effects active
|
||||||
|
hide-if-invisiblity-potion: true
|
||||||
|
# If true, player names are not shown on map, chat, list
|
||||||
|
hidenames: false
|
||||||
|
#- class: org.dynmap.JsonFileClientUpdateComponent
|
||||||
|
# writeinterval: 1
|
||||||
|
# sendhealth: true
|
||||||
|
# sendposition: true
|
||||||
|
# allowwebchat: true
|
||||||
|
# webchat-interval: 5
|
||||||
|
# hidewebchatip: false
|
||||||
|
# includehiddenplayers: false
|
||||||
|
# use-name-colors: false
|
||||||
|
# use-player-login-ip: false
|
||||||
|
# require-player-login-ip: false
|
||||||
|
# block-banned-player-chat: true
|
||||||
|
# hideifshadow: 0
|
||||||
|
# hideifundercover: 0
|
||||||
|
# hideifsneaking: false
|
||||||
|
# # Require login for web-to-server chat (requires login-enabled: true)
|
||||||
|
# webchat-requires-login: false
|
||||||
|
# # If set to true, users must have dynmap.webchat permission in order to chat
|
||||||
|
# webchat-permissions: false
|
||||||
|
# # Limit length of single chat messages
|
||||||
|
# chatlengthlimit: 256
|
||||||
|
# hide-if-invisiblity-potion: true
|
||||||
|
# hidenames: false
|
||||||
|
|
||||||
|
- class: org.dynmap.SimpleWebChatComponent
|
||||||
|
allowchat: true
|
||||||
|
# If true, web UI users can supply name for chat using 'playername' URL parameter. 'trustclientname' must also be set true.
|
||||||
|
allowurlname: false
|
||||||
|
|
||||||
|
# Note: this component is needed for the dmarker commands, and for the Marker API to be available to other plugins
|
||||||
|
- class: org.dynmap.MarkersComponent
|
||||||
|
type: markers
|
||||||
|
showlabel: false
|
||||||
|
enablesigns: false
|
||||||
|
# Default marker set for sign markers
|
||||||
|
default-sign-set: markers
|
||||||
|
# (optional) add spawn point markers to standard marker layer
|
||||||
|
showspawn: true
|
||||||
|
spawnicon: world
|
||||||
|
spawnlabel: "Spawn"
|
||||||
|
# (optional) layer for showing offline player's positions (for 'maxofflinetime' minutes after logoff)
|
||||||
|
showofflineplayers: false
|
||||||
|
offlinelabel: "Offline"
|
||||||
|
offlineicon: offlineuser
|
||||||
|
offlinehidebydefault: true
|
||||||
|
offlineminzoom: 0
|
||||||
|
maxofflinetime: 30
|
||||||
|
# (optional) layer for showing player's spawn beds
|
||||||
|
showspawnbeds: false
|
||||||
|
spawnbedlabel: "Spawn Beds"
|
||||||
|
spawnbedicon: bed
|
||||||
|
spawnbedhidebydefault: true
|
||||||
|
spawnbedminzoom: 0
|
||||||
|
spawnbedformat: "%name%'s bed"
|
||||||
|
# (optional) Show world border (vanilla 1.8+)
|
||||||
|
showworldborder: true
|
||||||
|
worldborderlabel: "Border"
|
||||||
|
|
||||||
|
- class: org.dynmap.ClientComponent
|
||||||
|
type: chat
|
||||||
|
allowurlname: false
|
||||||
|
- class: org.dynmap.ClientComponent
|
||||||
|
type: chatballoon
|
||||||
|
focuschatballoons: false
|
||||||
|
- class: org.dynmap.ClientComponent
|
||||||
|
type: chatbox
|
||||||
|
showplayerfaces: true
|
||||||
|
messagettl: 5
|
||||||
|
# Optional: set number of lines in scrollable message history: if set, messagettl is not used to age out messages
|
||||||
|
#scrollback: 100
|
||||||
|
# Optional: set maximum number of lines visible for chatbox
|
||||||
|
#visiblelines: 10
|
||||||
|
# Optional: send push button
|
||||||
|
sendbutton: false
|
||||||
|
- class: org.dynmap.ClientComponent
|
||||||
|
type: playermarkers
|
||||||
|
showplayerfaces: true
|
||||||
|
showplayerhealth: true
|
||||||
|
# If true, show player body too (only valid if showplayerfaces=true)
|
||||||
|
showplayerbody: false
|
||||||
|
# Option to make player faces small - don't use with showplayerhealth or largeplayerfaces
|
||||||
|
smallplayerfaces: false
|
||||||
|
# Option to make player faces larger - don't use with showplayerhealth or smallplayerfaces
|
||||||
|
largeplayerfaces: false
|
||||||
|
# Optional - make player faces layer hidden by default
|
||||||
|
hidebydefault: false
|
||||||
|
# Optional - ordering priority in layer menu (low goes before high - default is 0)
|
||||||
|
layerprio: 0
|
||||||
|
# Optional - label for player marker layer (default is 'Players')
|
||||||
|
label: "Players"
|
||||||
|
|
||||||
|
#- class: org.dynmap.ClientComponent
|
||||||
|
# type: digitalclock
|
||||||
|
- class: org.dynmap.ClientComponent
|
||||||
|
type: link
|
||||||
|
|
||||||
|
- class: org.dynmap.ClientComponent
|
||||||
|
type: timeofdayclock
|
||||||
|
showdigitalclock: true
|
||||||
|
#showweather: true
|
||||||
|
# Mouse pointer world coordinate display
|
||||||
|
- class: org.dynmap.ClientComponent
|
||||||
|
type: coord
|
||||||
|
label: "Location"
|
||||||
|
hidey: false
|
||||||
|
show-mcr: false
|
||||||
|
show-chunk: false
|
||||||
|
|
||||||
|
# Note: more than one logo component can be defined
|
||||||
|
#- class: org.dynmap.ClientComponent
|
||||||
|
# type: logo
|
||||||
|
# text: "Dynmap"
|
||||||
|
# #logourl: "images/block_surface.png"
|
||||||
|
# linkurl: "http://forums.bukkit.org/threads/dynmap.489/"
|
||||||
|
# # Valid positions: top-left, top-right, bottom-left, bottom-right
|
||||||
|
# position: bottom-right
|
||||||
|
|
||||||
|
#- class: org.dynmap.ClientComponent
|
||||||
|
# type: inactive
|
||||||
|
# timeout: 1800 # in seconds (1800 seconds = 30 minutes)
|
||||||
|
# redirecturl: inactive.html
|
||||||
|
# #showmessage: 'You were inactive for too long.'
|
||||||
|
|
||||||
|
#- class: org.dynmap.TestComponent
|
||||||
|
# stuff: "This is some configuration-value"
|
||||||
|
|
||||||
|
# Treat hiddenplayers.txt as a whitelist for players to be shown on the map? (Default false)
|
||||||
|
display-whitelist: false
|
||||||
|
|
||||||
|
# How often a tile gets rendered (in seconds).
|
||||||
|
renderinterval: 1
|
||||||
|
|
||||||
|
# How many tiles on update queue before accelerate render interval
|
||||||
|
renderacceleratethreshold: 60
|
||||||
|
|
||||||
|
# How often to render tiles when backlog is above renderacceleratethreshold
|
||||||
|
renderaccelerateinterval: 0.2
|
||||||
|
|
||||||
|
# How many update tiles to work on at once (if not defined, default is 1/2 the number of cores)
|
||||||
|
tiles-rendered-at-once: 2
|
||||||
|
|
||||||
|
# If true, use normal priority threads for rendering (versus low priority) - this can keep rendering
|
||||||
|
# from starving on busy Windows boxes (Linux JVMs pretty much ignore thread priority), but may result
|
||||||
|
# in more competition for CPU resources with other processes
|
||||||
|
usenormalthreadpriority: true
|
||||||
|
|
||||||
|
# Save and restore pending tile renders - prevents their loss on server shutdown or /reload
|
||||||
|
saverestorepending: true
|
||||||
|
|
||||||
|
# Save period for pending jobs (in seconds): periodic saving for crash recovery of jobs
|
||||||
|
save-pending-period: 900
|
||||||
|
|
||||||
|
# Zoom-out tile update period - how often to scan for and process tile updates into zoom-out tiles (in seconds)
|
||||||
|
zoomoutperiod: 30
|
||||||
|
|
||||||
|
# Control whether zoom out tiles are validated on startup (can be needed if zoomout processing is interrupted, but can be expensive on large maps)
|
||||||
|
initial-zoomout-validate: true
|
||||||
|
|
||||||
|
# Default delay on processing of updated tiles, in seconds. This can reduce potentially expensive re-rendering
|
||||||
|
# of frequently updated tiles (such as due to machines, pistons, quarries or other automation). Values can
|
||||||
|
# also be set on individual worlds and individual maps.
|
||||||
|
tileupdatedelay: 30
|
||||||
|
|
||||||
|
# Tile hashing is used to minimize tile file updates when no changes have occurred - set to false to disable
|
||||||
|
enabletilehash: true
|
||||||
|
|
||||||
|
# Optional - hide ores: render as normal stone (so that they aren't revealed by maps)
|
||||||
|
#hideores: true
|
||||||
|
|
||||||
|
# Optional - enabled BetterGrass style rendering of grass and snow block sides
|
||||||
|
#better-grass: true
|
||||||
|
|
||||||
|
# Optional - enable smooth lighting by default on all maps supporting it (can be set per map as lighting option)
|
||||||
|
smooth-lighting: true
|
||||||
|
|
||||||
|
# Optional - use world provider lighting table (good for custom worlds with custom lighting curves, like nether)
|
||||||
|
# false=classic Dynmap lighting curve
|
||||||
|
use-brightness-table: true
|
||||||
|
|
||||||
|
# Optional - render specific block names using the textures and models of another block name: can be used to hide/disguise specific
|
||||||
|
# blocks (e.g. make ores look like stone, hide chests) or to provide simple support for rendering unsupported custom blocks
|
||||||
|
block-alias:
|
||||||
|
# "minecraft:quartz_ore": "stone"
|
||||||
|
# "diamond_ore": "coal_ore"
|
||||||
|
|
||||||
|
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100),
|
||||||
|
# Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download)
|
||||||
|
#
|
||||||
|
# Has no effect on maps with explicit format settings
|
||||||
|
image-format: jpg-q90
|
||||||
|
|
||||||
|
# If cwebp or dwebp are not on the PATH, use these settings to provide their full path. Do not use these settings if the tools are on the PATH
|
||||||
|
# For Windows, include .exe
|
||||||
|
#
|
||||||
|
#cwebpPath: /usr/bin/cwebp
|
||||||
|
#dwebpPath: /usr/bin/dwebp
|
||||||
|
|
||||||
|
# use-generated-textures: if true, use generated textures (same as client); false is static water/lava textures
|
||||||
|
# correct-water-lighting: if true, use corrected water lighting (same as client); false is legacy water (darker)
|
||||||
|
# transparent-leaves: if true, leaves are transparent (lighting-wise): false is needed for some Spout versions that break lighting on leaf blocks
|
||||||
|
use-generated-textures: true
|
||||||
|
correct-water-lighting: true
|
||||||
|
transparent-leaves: true
|
||||||
|
|
||||||
|
# ctm-support: if true, Connected Texture Mod (CTM) in texture packs is enabled (default)
|
||||||
|
ctm-support: true
|
||||||
|
# custom-colors-support: if true, Custom Colors in texture packs is enabled (default)
|
||||||
|
custom-colors-support: true
|
||||||
|
|
||||||
|
# Control loading of player faces (if set to false, skins are never fetched)
|
||||||
|
#fetchskins: false
|
||||||
|
|
||||||
|
# Control updating of player faces, once loaded (if faces are being managed by other apps or manually)
|
||||||
|
#refreshskins: false
|
||||||
|
|
||||||
|
# Customize URL used for fetching player skins (%player% is macro for name, %uuid% for UUID)
|
||||||
|
skin-url: "http://skins.minecraft.net/MinecraftSkins/%player%.png"
|
||||||
|
|
||||||
|
# Control behavior for new (1.0+) compass orientation (sunrise moved 90 degrees: east is now what used to be south)
|
||||||
|
# default is 'newrose' (preserve pre-1.0 maps, rotate rose)
|
||||||
|
# 'newnorth' is used to rotate maps and rose (requires fullrender of any HDMap map - same as 'newrose' for FlatMap or KzedMap)
|
||||||
|
compass-mode: newnorth
|
||||||
|
|
||||||
|
# Triggers for automatic updates : blockupdate-with-id is debug for breaking down updates by ID:meta
|
||||||
|
# To disable, set just 'none' and comment/delete the rest
|
||||||
|
render-triggers:
|
||||||
|
- blockupdate
|
||||||
|
#- blockupdate-with-id
|
||||||
|
#- lightingupdate
|
||||||
|
- chunkpopulate
|
||||||
|
- chunkgenerate
|
||||||
|
#- none
|
||||||
|
|
||||||
|
# Title for the web page - if not specified, defaults to the server's name (unless it is the default of 'Unknown Server')
|
||||||
|
#webpage-title: "My Awesome Server Map"
|
||||||
|
|
||||||
|
# The path where the tile-files are placed.
|
||||||
|
tilespath: web/tiles
|
||||||
|
|
||||||
|
# The path where the web-files are located.
|
||||||
|
webpath: web
|
||||||
|
|
||||||
|
# If set to false, disable extraction of webpath content (good if using custom web UI or 3rd party web UI)
|
||||||
|
# Note: web interface is unsupported in this configuration - you're on your own
|
||||||
|
update-webpath-files: true
|
||||||
|
|
||||||
|
# The path were the /dynmapexp command exports OBJ ZIP files
|
||||||
|
exportpath: export
|
||||||
|
|
||||||
|
# The network-interface the webserver will bind to (0.0.0.0 for all interfaces, 127.0.0.1 for only local access).
|
||||||
|
# If not set, uses same setting as server in server.properties (or 0.0.0.0 if not specified)
|
||||||
|
#webserver-bindaddress: 0.0.0.0
|
||||||
|
|
||||||
|
# The TCP-port the webserver will listen on.
|
||||||
|
webserver-port: 8123
|
||||||
|
|
||||||
|
# Maximum concurrent session on internal web server - limits resources used in Bukkit server
|
||||||
|
max-sessions: 30
|
||||||
|
|
||||||
|
# Disables Webserver portion of Dynmap (Advanced users only)
|
||||||
|
disable-webserver: false
|
||||||
|
|
||||||
|
# Enable/disable having the web server allow symbolic links (true=compatible with existing code, false=more secure (default))
|
||||||
|
allow-symlinks: true
|
||||||
|
|
||||||
|
# Enable login support
|
||||||
|
login-enabled: false
|
||||||
|
# Require login to access website (requires login-enabled: true)
|
||||||
|
login-required: false
|
||||||
|
|
||||||
|
# Period between tile renders for fullrender, in seconds (non-zero to pace fullrenders, lessen CPU load)
|
||||||
|
timesliceinterval: 0.0
|
||||||
|
|
||||||
|
# Maximum chunk loads per server tick (1/20th of a second) - reducing this below 90 will impact render performance, but also will reduce server thread load
|
||||||
|
maxchunkspertick: 200
|
||||||
|
|
||||||
|
# Progress report interval for fullrender/radiusrender, in tiles. Must be 100 or greater
|
||||||
|
progressloginterval: 100
|
||||||
|
|
||||||
|
# Parallel fullrender: if defined, number of concurrent threads used for fullrender or radiusrender
|
||||||
|
# Note: setting this will result in much more intensive CPU use, some additional memory use. Caution should be used when
|
||||||
|
# setting this to equal or exceed the number of physical cores on the system.
|
||||||
|
#parallelrendercnt: 4
|
||||||
|
|
||||||
|
# Interval the browser should poll for updates.
|
||||||
|
updaterate: 2000
|
||||||
|
|
||||||
|
# If nonzero, server will pause fullrender/radiusrender processing when 'fullrenderplayerlimit' or more users are logged in
|
||||||
|
fullrenderplayerlimit: 0
|
||||||
|
# If nonzero, server will pause update render processing when 'updateplayerlimit' or more users are logged in
|
||||||
|
updateplayerlimit: 0
|
||||||
|
# Target limit on server thread use - msec per tick
|
||||||
|
per-tick-time-limit: 50
|
||||||
|
# If TPS of server is below this setting, update renders processing is paused
|
||||||
|
update-min-tps: 18.0
|
||||||
|
# If TPS of server is below this setting, full/radius renders processing is paused
|
||||||
|
fullrender-min-tps: 18.0
|
||||||
|
# If TPS of server is below this setting, zoom out processing is paused
|
||||||
|
zoomout-min-tps: 18.0
|
||||||
|
|
||||||
|
showplayerfacesinmenu: true
|
||||||
|
|
||||||
|
# Control whether players that are hidden or not on current map are grayed out (true=yes)
|
||||||
|
grayplayerswhenhidden: true
|
||||||
|
|
||||||
|
# Set sidebaropened: 'true' to pin menu sidebar opened permanently, 'pinned' to default the sidebar to pinned, but allow it to unpin
|
||||||
|
#sidebaropened: true
|
||||||
|
|
||||||
|
# Customized HTTP response headers - add 'id: value' pairs to all HTTP response headers (internal web server only)
|
||||||
|
#http-response-headers:
|
||||||
|
# Access-Control-Allow-Origin: "my-domain.com"
|
||||||
|
# X-Custom-Header-Of-Mine: "MyHeaderValue"
|
||||||
|
|
||||||
|
# Trusted proxies for web server - which proxy addresses are trusted to supply valid X-Forwarded-For fields
|
||||||
|
# This now supports both IP address, and subnet ranges (e.g. 192.168.1.0/24 or 202.24.0.0/14 )
|
||||||
|
trusted-proxies:
|
||||||
|
- "127.0.0.1"
|
||||||
|
- "0:0:0:0:0:0:0:1"
|
||||||
|
|
||||||
|
joinmessage: "%playername% joined"
|
||||||
|
quitmessage: "%playername% quit"
|
||||||
|
spammessage: "You may only chat once every %interval% seconds."
|
||||||
|
# format for messages from web: %playername% substitutes sender ID (typically IP), %message% includes text
|
||||||
|
webmsgformat: "&color;2[WEB] %playername%: &color;f%message%"
|
||||||
|
|
||||||
|
# Control whether layer control is presented on the UI (default is true)
|
||||||
|
showlayercontrol: true
|
||||||
|
|
||||||
|
# Enable checking for banned IPs via banned-ips.txt (internal web server only)
|
||||||
|
check-banned-ips: true
|
||||||
|
|
||||||
|
# Default selection when map page is loaded
|
||||||
|
defaultzoom: 0
|
||||||
|
defaultworld: world
|
||||||
|
defaultmap: flat
|
||||||
|
# (optional) Zoom level and map to switch to when following a player, if possible
|
||||||
|
#followzoom: 3
|
||||||
|
#followmap: surface
|
||||||
|
|
||||||
|
# If true, make persistent record of IP addresses used by player logins, to support web IP to player matching
|
||||||
|
persist-ids-by-ip: true
|
||||||
|
|
||||||
|
# If true, map text to cyrillic
|
||||||
|
cyrillic-support: false
|
||||||
|
|
||||||
|
# Messages to customize
|
||||||
|
msg:
|
||||||
|
maptypes: "Map Types"
|
||||||
|
players: "Players"
|
||||||
|
chatrequireslogin: "Chat Requires Login"
|
||||||
|
chatnotallowed: "You are not permitted to send chat messages"
|
||||||
|
hiddennamejoin: "Player joined"
|
||||||
|
hiddennamequit: "Player quit"
|
||||||
|
|
||||||
|
# URL for client configuration (only need to be tailored for proxies or other non-standard configurations)
|
||||||
|
url:
|
||||||
|
# configuration URL
|
||||||
|
#configuration: "up/configuration"
|
||||||
|
# update URL
|
||||||
|
#update: "up/world/{world}/{timestamp}"
|
||||||
|
# sendmessage URL
|
||||||
|
#sendmessage: "up/sendmessage"
|
||||||
|
# login URL
|
||||||
|
#login: "up/login"
|
||||||
|
# register URL
|
||||||
|
#register: "up/register"
|
||||||
|
# tiles base URL
|
||||||
|
#tiles: "tiles/"
|
||||||
|
# markers base URL
|
||||||
|
#markers: "tiles/"
|
||||||
|
# Snapshot cache size, in chunks
|
||||||
|
snapshotcachesize: 500
|
||||||
|
# Snapshot cache uses soft references (true), else weak references (false)
|
||||||
|
soft-ref-cache: true
|
||||||
|
|
||||||
|
# Player enter/exit title messages for map markers
|
||||||
|
#
|
||||||
|
# Processing period - how often to check player positions vs markers - default is 1000ms (1 second)
|
||||||
|
#enterexitperiod: 1000
|
||||||
|
# Title message fade in time, in ticks (0.05 second intervals) - default is 10 (1/2 second)
|
||||||
|
#titleFadeIn: 10
|
||||||
|
# Title message stay time, in ticks (0.05 second intervals) - default is 70 (3.5 seconds)
|
||||||
|
#titleStay: 70
|
||||||
|
# Title message fade out time, in ticks (0.05 seocnd intervals) - default is 20 (1 second)
|
||||||
|
#titleFadeOut: 20
|
||||||
|
# Enter/exit messages use on screen titles (true - default), if false chat messages are sent instead
|
||||||
|
#enterexitUseTitle: true
|
||||||
|
# Set true if new enter messages should supercede pending exit messages (vs being queued in order), default false
|
||||||
|
#enterReplacesExits: true
|
||||||
|
|
||||||
|
# Published public URL for Dynmap server (allows users to use 'dynmap url' command to get public URL usable to access server
|
||||||
|
# If not set, 'dynmap url' will not return anything. URL should be fully qualified (e.g. https://mc.westeroscraft.com/)
|
||||||
|
#publicURL: http://my.greatserver.com/dynmap
|
||||||
|
|
||||||
|
# Send this message if the player does not have permission to use the command
|
||||||
|
noPermissionMsg: "You don't have permission to use this command!"
|
||||||
|
|
||||||
|
# Set to true to enable verbose startup messages - can help with debugging map configuration problems
|
||||||
|
# Set to false for a much quieter startup log
|
||||||
|
verbose: false
|
||||||
|
|
||||||
|
# Enables debugging.
|
||||||
|
#debuggers:
|
||||||
|
# - class: org.dynmap.debug.LogDebugger
|
||||||
|
# Debug: dump blocks missing render data
|
||||||
|
dump-missing-blocks: false
|
||||||
|
|
||||||
|
# Log4J defense: string substituted for attempts to use macros in web chat
|
||||||
|
hackAttemptBlurb: "(IaM5uchA1337Haxr-Ban Me!)"
|
8
forge-1.20/src/main/resources/pack.mcmeta
Normal file
8
forge-1.20/src/main/resources/pack.mcmeta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"pack": {
|
||||||
|
"description": {
|
||||||
|
"text": "Dynmap resources"
|
||||||
|
},
|
||||||
|
"pack_format": 15
|
||||||
|
}
|
||||||
|
}
|
27
forge-1.20/src/main/resources/permissions.yml.example
Normal file
27
forge-1.20/src/main/resources/permissions.yml.example
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#
|
||||||
|
# Sample permissions.yml for dynmap - trivial, flat-file based permissions for dynmap features
|
||||||
|
# To use, copy this file to dynmap/permissions.yml, and edit appropriate. File is YAML format.
|
||||||
|
#
|
||||||
|
# All operators have full permissions to all functions.
|
||||||
|
# All users receive the permissions under the 'defaultuser' section
|
||||||
|
# Specific users can be given more permissions by defining a section with their name containing their permisssions
|
||||||
|
# All permissions correspond to those documented here (https://github.com/webbukkit/dynmap/wiki/Permissions), but
|
||||||
|
# do NOT have the 'dynmap.' prefix when used here (e.g. 'dynmap.fullrender' permission is just 'fullrender' here).
|
||||||
|
#
|
||||||
|
defaultuser:
|
||||||
|
- render
|
||||||
|
- show.self
|
||||||
|
- hide.self
|
||||||
|
- sendtoweb
|
||||||
|
- stats
|
||||||
|
- marker.list
|
||||||
|
- marker.listsets
|
||||||
|
- marker.icons
|
||||||
|
- webregister
|
||||||
|
- webchat
|
||||||
|
#- marker.sign
|
||||||
|
|
||||||
|
#playername1:
|
||||||
|
# - fullrender
|
||||||
|
# - cancelrender
|
||||||
|
# - radiusrender
|
@ -22,6 +22,7 @@ include ':bukkit-helper-118-2'
|
|||||||
include ':bukkit-helper-119'
|
include ':bukkit-helper-119'
|
||||||
include ':bukkit-helper-119-3'
|
include ':bukkit-helper-119-3'
|
||||||
include ':bukkit-helper-119-4'
|
include ':bukkit-helper-119-4'
|
||||||
|
//include ':bukkit-helper-120'
|
||||||
include ':bukkit-helper'
|
include ':bukkit-helper'
|
||||||
include ':dynmap-api'
|
include ':dynmap-api'
|
||||||
include ':DynmapCore'
|
include ':DynmapCore'
|
||||||
@ -36,6 +37,7 @@ include ':fabric-1.17.1'
|
|||||||
include ':fabric-1.16.4'
|
include ':fabric-1.16.4'
|
||||||
include ':fabric-1.15.2'
|
include ':fabric-1.15.2'
|
||||||
include ':fabric-1.14.4'
|
include ':fabric-1.14.4'
|
||||||
|
include ':forge-1.20'
|
||||||
include ':forge-1.19.3'
|
include ':forge-1.19.3'
|
||||||
include ':forge-1.19.2'
|
include ':forge-1.19.2'
|
||||||
include ':forge-1.19'
|
include ':forge-1.19'
|
||||||
@ -59,6 +61,7 @@ project(':bukkit-helper-118-2').projectDir = "$rootDir/bukkit-helper-118-2" as F
|
|||||||
project(':bukkit-helper-119').projectDir = "$rootDir/bukkit-helper-119" as File
|
project(':bukkit-helper-119').projectDir = "$rootDir/bukkit-helper-119" as File
|
||||||
project(':bukkit-helper-119-3').projectDir = "$rootDir/bukkit-helper-119-3" as File
|
project(':bukkit-helper-119-3').projectDir = "$rootDir/bukkit-helper-119-3" as File
|
||||||
project(':bukkit-helper-119-4').projectDir = "$rootDir/bukkit-helper-119-4" as File
|
project(':bukkit-helper-119-4').projectDir = "$rootDir/bukkit-helper-119-4" as File
|
||||||
|
//project(':bukkit-helper-120').projectDir = "$rootDir/bukkit-helper-120" as File
|
||||||
project(':bukkit-helper').projectDir = "$rootDir/bukkit-helper" as File
|
project(':bukkit-helper').projectDir = "$rootDir/bukkit-helper" as File
|
||||||
project(':dynmap-api').projectDir = "$rootDir/dynmap-api" as File
|
project(':dynmap-api').projectDir = "$rootDir/dynmap-api" as File
|
||||||
project(':DynmapCore').projectDir = "$rootDir/DynmapCore" as File
|
project(':DynmapCore').projectDir = "$rootDir/DynmapCore" as File
|
||||||
@ -73,6 +76,7 @@ project(':fabric-1.17.1').projectDir = "$rootDir/fabric-1.17.1" as File
|
|||||||
project(':fabric-1.16.4').projectDir = "$rootDir/fabric-1.16.4" as File
|
project(':fabric-1.16.4').projectDir = "$rootDir/fabric-1.16.4" as File
|
||||||
project(':fabric-1.15.2').projectDir = "$rootDir/fabric-1.15.2" as File
|
project(':fabric-1.15.2').projectDir = "$rootDir/fabric-1.15.2" as File
|
||||||
project(':fabric-1.14.4').projectDir = "$rootDir/fabric-1.14.4" as File
|
project(':fabric-1.14.4').projectDir = "$rootDir/fabric-1.14.4" as File
|
||||||
|
project(':forge-1.20').projectDir = "$rootDir/forge-1.20" as File
|
||||||
project(':forge-1.19.3').projectDir = "$rootDir/forge-1.19.3" as File
|
project(':forge-1.19.3').projectDir = "$rootDir/forge-1.19.3" as File
|
||||||
project(':forge-1.19.2').projectDir = "$rootDir/forge-1.19.2" as File
|
project(':forge-1.19.2').projectDir = "$rootDir/forge-1.19.2" as File
|
||||||
project(':forge-1.18.2').projectDir = "$rootDir/forge-1.18.2" as File
|
project(':forge-1.18.2').projectDir = "$rootDir/forge-1.18.2" as File
|
||||||
|
Loading…
Reference in New Issue
Block a user