Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am abueide on github.
  • I am andreabueide (https://keybase.io/andreabueide) on keybase.
  • I have a public key ASB-quQ6nzeOy6-Ck9oe8TvF45cwO6yqElYHPKb1NQj19Qo

To claim this, I am signing this object:

package com.abysl.realms.client.network
import com.abysl.realms.shared.services.Service
import io.ktor.network.selector.*
import io.ktor.network.sockets.*
import io.ktor.network.tls.*
import io.ktor.utils.io.*
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
import java.net.ConnectException
package com.abysl.realms.server.network.services
import com.abysl.realms.server.network.ServerSettings
import com.abysl.realms.shared.services.Service
import io.ktor.network.selector.*
import io.ktor.network.sockets.*
import io.ktor.network.tls.certificates.*
import io.ktor.utils.io.*
import io.ktor.utils.io.core.*
import kotlinx.coroutines.*
class EventService : Service(true) {
// Have to do a MutableList<Any>, then do unsafe cast later. Couldn't think of another way to do it
val subscriptions: MutableMap<KClass<out BaseEvent>, MutableList<Any>> = mutableMapOf()
val packetSubscriptions: MutableMap<KClass<out Packet>, MutableList<Any>> = mutableMapOf()
private val events: ConcurrentLinkedQueue<BaseEvent> = ConcurrentLinkedQueue()
inline fun <reified T : BaseEvent> subscribe(noinline subscriber: (T) -> Unit) {
val event = T::class

Keybase proof

I hereby claim:

  • I am abueide on github.
  • I am ampbueide (https://keybase.io/ampbueide) on keybase.
  • I have a public key ASCFhPzHxvBmYE3UNtD36ZtASflgLTzbCQRqMD3JwL0eRQo

To claim this, I am signing this object:

kotlinx.serialization.SerializationException: Class 'TempDrive' is not registered for polymorphic serialization in the scope of 'Drive'.
Mark the base class as 'sealed' or register the serializer explicitly.
at kotlinx.serialization.internal.AbstractPolymorphicSerializerKt.throwSubtypeNotRegistered(AbstractPolymorphicSerializer.kt:102)
at kotlinx.serialization.internal.AbstractPolymorphicSerializerKt.throwSubtypeNotRegistered(AbstractPolymorphicSerializer.kt:113)
at kotlinx.serialization.PolymorphicSerializerKt.findPolymorphicSerializer(PolymorphicSerializer.kt:96)
at kotlinx.serialization.json.internal.PolymorphicKt.findActualSerializer(Polymorphic.kt:29)
at kotlinx.serialization.json.internal.PolymorphicKt.access$findActualSerializer(Polymorphic.kt:1)
at kotlinx.serialization.json.internal.StreamingJsonEncoder.encodeSerializableValue(StreamingJsonEncoder.kt:214)
at kotlinx.serialization.encoding.AbstractEncoder.encodeSerializableElement(AbstractEncoder.kt:80)
at kotlinx.serialization.internal.ListLi

Keybase proof

I hereby claim:

  • I am abueide on github.
  • I am dazaidesu (https://keybase.io/dazaidesu) on keybase.
  • I have a public key ASBTA1m5IXEgzmN2KSirxSayITyWfcgzQ4iehXfsjblwugo

To claim this, I am signing this object:

@abueide
abueide / pubsub
Created September 2, 2020 07:39
pubsub system
package com.abysl.gdxcrawler.ecs.events
import com.abysl.gdxcrawler.ecs.events.input.MoveEvent
import java.util.*
class EventManager {
// has to be public because of inline fun, would rather be private
// Have to do a MutableList<Any>, then do unsafe cast later. Couldn't think of another way to do it
val subscriptions: MutableMap<Class<out Event>, MutableList<Any>> = mutableMapOf()
package com.abyssalrealms
import com.abyssalrealms.ecs.components.MovementComponent
import com.abyssalrealms.ecs.components.PlayerComponent
import com.abyssalrealms.ecs.components.PositionComponent
import com.abyssalrealms.ecs.components.RenderComponent
import com.abyssalrealms.ecs.systems.InputSystem
import com.abyssalrealms.ecs.systems.MovementSystem
import com.abyssalrealms.ecs.systems.RenderSystem
import com.artemis.World

Keybase proof

I hereby claim:

  • I am abueide on github.
  • I am abueide (https://keybase.io/abueide) on keybase.
  • I have a public key ASCVF7nDDeuAri8YTAUPOdfhFlU1HNQ5LOlea-KwEZNspwo

To claim this, I am signing this object: