Applied kotlin style conventions
This commit is contained in:
@@ -15,13 +15,12 @@ interface SpigotSerialzableCompanion<T>
|
||||
/**
|
||||
* @return A json string.
|
||||
*/
|
||||
fun SpigotSerializable<*>.serialize(pretty: Boolean = true): String
|
||||
= ValueHolder.getGson(pretty).toJson(this)
|
||||
fun SpigotSerializable<*>.serialize(pretty: Boolean = true): String = ValueHolder.getGson(pretty).toJson(this)
|
||||
|
||||
/**
|
||||
* Deserializes the given json string and
|
||||
* returns the deserialized object.
|
||||
*/
|
||||
@Suppress("unused")
|
||||
inline fun <reified T> SpigotSerialzableCompanion<T>.deserialize(json: String): T
|
||||
= ValueHolder.getGson(false).fromJson(json, T::class.java)
|
||||
inline fun <reified T> SpigotSerialzableCompanion<T>.deserialize(json: String): T =
|
||||
ValueHolder.getGson(false).fromJson(json, T::class.java)
|
@@ -19,8 +19,7 @@ class SerializableLocation(
|
||||
|
||||
constructor(loc: Location) : this(loc.world?.name, loc.x, loc.y, loc.z, SerializableVector(loc.direction))
|
||||
|
||||
override fun toSpigot()
|
||||
= Location(world?.let { Bukkit.getWorld(world) }, x, y, z)
|
||||
.apply { direction = this@SerializableLocation.direction.toSpigot() }
|
||||
override fun toSpigot() = Location(world?.let { Bukkit.getWorld(world) }, x, y, z)
|
||||
.apply { direction = this@SerializableLocation.direction.toSpigot() }
|
||||
|
||||
}
|
Reference in New Issue
Block a user