Merge branch 'master' into bleeding

This commit is contained in:
Blue (Lukas Rieger) 2021-07-25 12:57:11 +02:00
commit 8838bd6f32
No known key found for this signature in database
GPG Key ID: 904C4995F9E1F800
3 changed files with 28 additions and 15 deletions

View File

@ -96,7 +96,7 @@ public Collection<BlueMapWorld> getWorlds() {
@Override
public String createImage(BufferedImage image, String path) throws IOException {
path = path.replaceAll("[^a-zA-Z_\\.\\-\\/]", "_");
path = path.replaceAll("[^a-zA-Z0-9_.\\-/]", "_");
String separator = FileSystems.getDefault().getSeparator();
Path webRoot = plugin.getRenderConfig().getWebRoot().toPath().toAbsolutePath();

View File

@ -60,10 +60,9 @@
import de.bluecolored.bluemap.core.map.BmMap;
import de.bluecolored.bluemap.core.map.MapRenderState;
import de.bluecolored.bluemap.core.mca.ChunkAnvil112;
import de.bluecolored.bluemap.core.mca.MCAChunk;
import de.bluecolored.bluemap.core.mca.MCAWorld;
import de.bluecolored.bluemap.core.resourcepack.ParseResourceException;
import de.bluecolored.bluemap.core.world.Block;
import de.bluecolored.bluemap.core.world.Chunk;
import de.bluecolored.bluemap.core.world.World;
import java.io.IOException;
@ -529,23 +528,24 @@ public int debugBlockCommand(CommandContext<S> context) {
new Thread(() -> {
// collect and output debug info
Vector3i blockPos = position.floor().toInt();
Block block = new Block(world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
Block blockBelow = new Block(null, 0, 0, 0).copy(block).add(0, -1, 0);
Block block = world.getBlock(blockPos);
Block blockBelow = world.getBlock(blockPos.add(0, -1, 0));
String blockIdMeta = "";
String blockBelowIdMeta = "";
if (world instanceof MCAWorld) {
MCAChunk chunk = ((MCAWorld) world).getChunkAtBlock(blockPos.getX(), blockPos.getY(), blockPos.getZ());
if (chunk instanceof ChunkAnvil112) {
blockIdMeta = " (" + ((ChunkAnvil112) chunk).getBlockIdMeta(blockPos) + ")";
blockBelowIdMeta = " (" + ((ChunkAnvil112) chunk).getBlockIdMeta(blockPos.add(0, -1, 0)) + ")";
}
Vector2i chunkPos = world.getChunkGrid().getCell(blockPos.toVector2(true));
Chunk chunk = world.getChunk(chunkPos.getX(), chunkPos.getY());
if (chunk instanceof ChunkAnvil112) {
blockIdMeta = " (" + ((ChunkAnvil112) chunk).getBlockIdMeta(blockPos) + ")";
blockBelowIdMeta = " (" + ((ChunkAnvil112) chunk).getBlockIdMeta(blockPos.add(0, -1, 0)) + ")";
}
source.sendMessages(Arrays.asList(
Text.of(TextColor.GOLD, "Block at you: ", TextColor.WHITE, block, TextColor.GRAY, blockIdMeta),
Text.of(TextColor.GOLD, "Block below you: ", TextColor.WHITE, blockBelow, TextColor.GRAY, blockBelowIdMeta)
Text.of(TextColor.GOLD, "Block below you: ", TextColor.WHITE, blockBelow, TextColor.GRAY, blockBelowIdMeta),
Text.of(TextColor.GOLD, "Chunk: ", TextColor.WHITE, chunk)
));
}).start();
@ -749,13 +749,18 @@ public int updateCommand(CommandContext<S> context, boolean force) {
if (worldToRender != null) {
plugin.getServerInterface().persistWorldChanges(worldToRender.getUUID());
for (BmMap map : plugin.getMapTypes()) {
if (map.getWorld().equals(worldToRender)) maps.add(map);
if (map.getWorld().getUUID().equals(worldToRender.getUUID())) maps.add(map);
}
} else {
plugin.getServerInterface().persistWorldChanges(mapToRender.getWorld().getUUID());
maps.add(mapToRender);
}
if (maps.isEmpty()) {
source.sendMessage(Text.of(TextColor.RED, "No map has been found for this world that could be updated!"));
return;
}
for (BmMap map : maps) {
MapUpdateTask updateTask = new MapUpdateTask(map, center, radius);
plugin.getRenderManager().scheduleRenderTask(updateTask);

View File

@ -84,4 +84,12 @@ public static MCAChunk empty() {
return EmptyChunk.INSTANCE;
}
@Override
public String toString() {
return "MCAChunk{" +
"dataVersion=" + dataVersion +
"isGenerated()=" + isGenerated() +
'}';
}
}