Can't find a codec for my class (kotlin)

Exception:

[12:13:11 ERROR]: Could not pass event PlayerJoinEvent to Login v0.1-ALPHA
org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:67) ~[PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:541) [PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:517) [PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at net.minecraft.server.v1_8_R3.PlayerList.onPlayerJoin(PlayerList.java:320) [PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at net.minecraft.server.v1_8_R3.PlayerList.a(PlayerList.java:173) [PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at net.minecraft.server.v1_8_R3.LoginListener.b(LoginListener.java:144) [PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at net.minecraft.server.v1_8_R3.LoginListener.c(LoginListener.java:54) [PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at net.minecraft.server.v1_8_R3.NetworkManager.a(NetworkManager.java:231) [PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at net.minecraft.server.v1_8_R3.ServerConnection.c(ServerConnection.java:148) [PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:982) [PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:819) [PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:715) [PaperSpigot.jar:git-PaperSpigot-"e447335"]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_282]
Caused by: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class com.redefantasy.core.shared.world.location.SerializedLocation.
        at org.bson.internal.CodecCache.lambda$getOrThrow$1(CodecCache.java:52) ~[?:?]
        at java.util.Optional.orElseThrow(Optional.java:290) ~[?:1.8.0_282]
        at org.bson.internal.CodecCache.getOrThrow(CodecCache.java:51) ~[?:?]
        at org.bson.internal.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:64) ~[?:?]
        at org.bson.internal.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:39) ~[?:?]
        at com.mongodb.internal.operation.Operations.createFindOperation(Operations.java:163) ~[?:?]
        at com.mongodb.internal.operation.Operations.findFirst(Operations.java:148) ~[?:?]
        at com.mongodb.internal.operation.SyncOperations.findFirst(SyncOperations.java:88) ~[?:?]
        at com.mongodb.client.internal.FindIterableImpl.first(FindIterableImpl.java:200) ~[?:?]
        at com.redefantasy.login.storage.repositories.implementations.MongoSpawnRepository.fetch(MongoSpawnRepository.kt:24) ~[?:?]
        at com.redefantasy.login.listeners.GeneralListeners.on(GeneralListeners.kt:81) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_282]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_282]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_282]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_282]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:300) ~[PaperSpigot.jar:git-PaperSpigot-"e447335"]
        ... 15 more

Code:

package com.redefantasy.core.shared.providers.databases.mongo

import com.mongodb.ConnectionString
import com.mongodb.MongoClientSettings
import com.mongodb.MongoCredential
import com.mongodb.client.MongoClient
import com.mongodb.client.MongoClients
import com.mongodb.client.MongoDatabase
import com.redefantasy.core.shared.providers.databases.IDatabaseProvider
import org.bson.codecs.configuration.CodecRegistries
import org.bson.codecs.pojo.PojoCodecProvider
import java.net.InetSocketAddress

/**
 * @author SrGutyerrez
 **/
class MongoDatabaseProvider(
    private val address: InetSocketAddress,
    private val user: String,
    private val password: String,
    private val database: String
) : IDatabaseProvider<MongoDatabase> {

    private lateinit var mongoClient: MongoClient
    private lateinit var mongoDatabase: MongoDatabase

    override fun prepare() {
        val mongoClientSettings = MongoClientSettings.builder()
            .applyConnectionString(
                ConnectionString(
                    "mongodb://${this.address.address.hostAddress}:${this.address.port}"
                )
            )
            .credential(
                MongoCredential.createCredential(
                    this.user,
                    "admin",
                    this.password.toCharArray()
                )
            )
            .codecRegistry(
                CodecRegistries.fromRegistries(
                    MongoClientSettings.getDefaultCodecRegistry(),
                    CodecRegistries.fromProviders(
                        PojoCodecProvider.builder()
                            .automatic(true)
                            .build()
                    )
                )
            )
            .build()

        this.mongoClient = MongoClients.create(mongoClientSettings)

        this.mongoDatabase = mongoClient.getDatabase(this.database)
    }

    override fun provide() = this.mongoDatabase

    override fun shutdown() = this.mongoClient.close()

}

Hi @Gutyerrez_N_A,

Can you share the code of the com.redefantasy.core.shared.world.location.SerializedLocation class? Is it a Kotlin data class?

Thanks,
Jeff