net.chestmc.nbt.LocationAdapter.kt Maven / Gradle / Ivy
package net.chestmc.nbt
import net.minecraft.server.NBTTagCompound
import org.bukkit.Location
/**
* A tag adapter for adapting [Location].
*/
object LocationAdapter : TagAdapter {
override fun load(key: String, tag: NBTTagCompound): Location {
return Location.from(tag.getString(key))
}
override fun save(key: String, value: Location, tag: NBTTagCompound) {
tag.setString(key, "${value.world.name}|${value.toCoordinate()}")
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy