diff --git a/foundation-heimdall/src/main/kotlin/cloud/kubelet/foundation/heimdall/Extensions.kt b/foundation-heimdall/src/main/kotlin/cloud/kubelet/foundation/heimdall/Extensions.kt index 3e07a2c..b0bb391 100644 --- a/foundation-heimdall/src/main/kotlin/cloud/kubelet/foundation/heimdall/Extensions.kt +++ b/foundation-heimdall/src/main/kotlin/cloud/kubelet/foundation/heimdall/Extensions.kt @@ -1,7 +1,5 @@ package cloud.kubelet.foundation.heimdall -import org.bukkit.Material - fun String.sqlSplitStatements(): List { val statements = mutableListOf() val buffer = StringBuilder() @@ -21,6 +19,3 @@ fun String.sqlSplitStatements(): List { flush() return statements } - -val Material.storageBlockName: String - get() = "${key.namespace}:${key.key}" diff --git a/foundation-heimdall/src/main/kotlin/cloud/kubelet/foundation/heimdall/event/BlockBreak.kt b/foundation-heimdall/src/main/kotlin/cloud/kubelet/foundation/heimdall/event/BlockBreak.kt index d7f6927..0111e26 100644 --- a/foundation-heimdall/src/main/kotlin/cloud/kubelet/foundation/heimdall/event/BlockBreak.kt +++ b/foundation-heimdall/src/main/kotlin/cloud/kubelet/foundation/heimdall/event/BlockBreak.kt @@ -1,6 +1,5 @@ package cloud.kubelet.foundation.heimdall.event -import cloud.kubelet.foundation.heimdall.storageBlockName import cloud.kubelet.foundation.heimdall.table.BlockBreakTable import org.bukkit.Location import org.bukkit.Material @@ -29,7 +28,7 @@ class BlockBreak( it[z] = location.z it[pitch] = location.pitch.toDouble() it[yaw] = location.yaw.toDouble() - it[block] = material.storageBlockName + it[block] = material.key.toString() } } } diff --git a/foundation-heimdall/src/main/kotlin/cloud/kubelet/foundation/heimdall/event/BlockPlace.kt b/foundation-heimdall/src/main/kotlin/cloud/kubelet/foundation/heimdall/event/BlockPlace.kt index 501bc07..aac5f28 100644 --- a/foundation-heimdall/src/main/kotlin/cloud/kubelet/foundation/heimdall/event/BlockPlace.kt +++ b/foundation-heimdall/src/main/kotlin/cloud/kubelet/foundation/heimdall/event/BlockPlace.kt @@ -1,6 +1,5 @@ package cloud.kubelet.foundation.heimdall.event -import cloud.kubelet.foundation.heimdall.storageBlockName import cloud.kubelet.foundation.heimdall.table.BlockPlaceTable import org.bukkit.Location import org.bukkit.Material @@ -29,7 +28,7 @@ class BlockPlace( it[z] = location.z it[pitch] = location.pitch.toDouble() it[yaw] = location.yaw.toDouble() - it[block] = material.storageBlockName + it[block] = material.key.toString() } } } diff --git a/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/export/ChunkExportLoader.kt b/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/export/ChunkExportLoader.kt index 0387483..35a54e3 100644 --- a/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/export/ChunkExportLoader.kt +++ b/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/export/ChunkExportLoader.kt @@ -22,7 +22,7 @@ class ChunkExportLoader( chunkFiles = chunkFiles.take(limit) } if (fast) { - chunkFiles.parallelStream().forEach { loadChunkFile(it, id = chunkFiles.indexOf(it)) } + chunkFiles.withIndex().toList().parallelStream().forEach { loadChunkFile(it.value, id = it.index) } } else { for (filePath in chunkFiles) { loadChunkFile(filePath, id = chunkFiles.indexOf(filePath)) diff --git a/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/render/LaunchGraphicalRenderSession.kt b/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/render/LaunchGraphicalRenderSession.kt index 8da97b9..de89392 100644 --- a/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/render/LaunchGraphicalRenderSession.kt +++ b/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/render/LaunchGraphicalRenderSession.kt @@ -5,11 +5,16 @@ import cloud.kubelet.foundation.gjallarhorn.state.BlockExpanse import cloud.kubelet.foundation.gjallarhorn.state.BlockStateMap import cloud.kubelet.foundation.gjallarhorn.state.ChangelogSlice import java.awt.image.BufferedImage +import javax.swing.WindowConstants class LaunchGraphicalRenderSession(val expanse: BlockExpanse) : BlockImageRenderer { override fun render(slice: ChangelogSlice, map: BlockStateMap): BufferedImage { val session = GraphicalRenderSession(expanse, map) session.isVisible = true + session.defaultCloseOperation = WindowConstants.HIDE_ON_CLOSE + while (session.isVisible) { + Thread.sleep(1000) + } return BufferedImage(1, 1, BufferedImage.TYPE_3BYTE_BGR) } } diff --git a/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/state/BlockChangeType.kt b/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/state/BlockChangeType.kt index 3273f5c..3f28483 100644 --- a/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/state/BlockChangeType.kt +++ b/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/state/BlockChangeType.kt @@ -1,5 +1,8 @@ package cloud.kubelet.foundation.gjallarhorn.state +import kotlinx.serialization.Serializable + +@Serializable enum class BlockChangeType { Place, Break diff --git a/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/state/BlockLogTrackerStateMap.kt b/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/state/BlockLogTrackerStateMap.kt deleted file mode 100644 index cb52ba3..0000000 --- a/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/state/BlockLogTrackerStateMap.kt +++ /dev/null @@ -1,21 +0,0 @@ -package cloud.kubelet.foundation.gjallarhorn.state - -class BlockLogTrackerStateMap(val tracker: BlockLogTracker) : BlockStateMap { - override fun get(position: BlockCoordinate): BlockState? = tracker.get(position) - - override fun getVerticalSection(x: Long, z: Long): Map { - return tracker.blocks.filter { it.key.x == x && it.key.z == z }.mapKeys { it.key.y } - } - - override fun getXSection(x: Long): Map>? { - throw RuntimeException("X section not supported.") - } - - override fun put(position: BlockCoordinate, value: BlockState) { - throw RuntimeException("Modification not supported.") - } - - override fun createOrModify(position: BlockCoordinate, create: () -> BlockState, modify: (BlockState) -> Unit) { - throw RuntimeException("Modification not supported.") - } -} diff --git a/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/util/compose.kt b/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/util/compose.kt index 2e1e0e3..3351ccf 100644 --- a/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/util/compose.kt +++ b/tool-gjallarhorn/src/main/kotlin/cloud/kubelet/foundation/gjallarhorn/util/compose.kt @@ -6,6 +6,7 @@ fun compose( combine: (Op, Op) -> Op, vararg filters: Pair<() -> Boolean, () -> Op> ): Op = filters.toMap().entries + .asSequence() .filter { it.key() } .map { it.value() } .fold(Op.TRUE as Op, combine)