Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Serialize regions
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoDog896 committed Apr 3, 2022
1 parent e4ac1cb commit 8b3e013
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {
compileOnly(kotlin("reflect"))

// Compile Minestom into project
compileOnly("com.github.Minestom:Minestom:4ee5cbe424")
compileOnly("com.github.LeoDog896", "Minestom", "fc441737f4")

// Get KStom
compileOnly("com.github.Project-Cepi:KStom:f962764331")
Expand Down
14 changes: 14 additions & 0 deletions src/main/kotlin/world/cepi/region/api/Region.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import net.minestom.server.event.EventNode
import net.minestom.server.instance.Instance
import net.minestom.server.tag.Tag
import net.minestom.server.tag.TagHandler
import net.minestom.server.tag.TagReadable
import org.jglrxavpok.hephaistos.nbt.NBTCompound
import org.jglrxavpok.hephaistos.nbt.NBTCompoundLike
import world.cepi.kstom.Manager
import world.cepi.kstom.event.listenOnly
import world.cepi.kstom.item.get
Expand Down Expand Up @@ -188,6 +190,18 @@ data class Region(
override fun <T : Any?> setTag(tag: Tag<T>, value: T?) {
tag.write(nbtCompound.toMutableCompound(), value)
}

override fun readableCopy(): TagReadable {
TODO("Not yet implemented")
}

override fun updateContent(compound: NBTCompoundLike) {
TODO("Not yet implemented")
}

override fun asCompound(): NBTCompound {
TODO("Not yet implemented")
}
}

var Player.region: Region?
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/world/cepi/region/api/RegionProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ object RegionProvider {
fun loadFromPath(path: Path) {
regions as MutableMap

val loaded = try {
format.decodeFromString<Map<String,Region>>(path.readText())
val loaded: Map<String, Region> = try {
format.decodeFromString(path.readText())
} catch (exception: Exception) {
exception.printStackTrace()
mutableMapOf()
}

Expand Down

0 comments on commit 8b3e013

Please sign in to comment.