Shynixn / MCCoroutine

MCCoroutine is a library, which adds extensive support for Kotlin Coroutines for Minecraft Server environments.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MCCoroutine for velocity does not work in velocity 3.2.x

JSH32 opened this issue · comments

[15:22:46 ERROR]: Exception in thread "main" java.lang.RuntimeException: Exception while trying to handle coroutine exception
[15:22:46 ERROR]:       at kotlinx.coroutines.CoroutineExceptionHandlerKt.handlerException(CoroutineExceptionHandler.kt:38)
[15:22:46 ERROR]:       at kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(CoroutineExceptionHandler.kt:29)
[15:22:46 ERROR]:       at kotlinx.coroutines.StandaloneCoroutine.handleJobException(Builders.common.kt:196)
[15:22:46 ERROR]:       at kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:229)
[15:22:46 ERROR]:       at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:906)
[15:22:46 ERROR]:       at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:863)
[15:22:46 ERROR]:       at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:828)
[15:22:46 ERROR]:       at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:100)
[15:22:46 ERROR]:       at kotlinx.coroutines.intrinsics.CancellableKt.dispatcherFailure(Cancellable.kt:65)
[15:22:46 ERROR]:       at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:78)
[15:22:46 ERROR]:       at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25)
[15:22:46 ERROR]:       at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:110)
[15:22:46 ERROR]:       at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
[15:22:46 ERROR]:       at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
[15:22:46 ERROR]:       at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
[15:22:46 ERROR]:       at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
[15:22:46 ERROR]:       at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source)
[15:22:46 ERROR]:       at com.github.shynixn.mccoroutine.velocity.impl.MCCoroutineImpl.setupCoroutineSession(MCCoroutineImpl.kt:52)
[15:22:46 ERROR]:       at com.github.shynixn.mccoroutine.velocity.SuspendingPluginContainer.initialize(SuspendingPluginContainer.kt:44)
[15:22:46 ERROR]:       at com.github.jsh32.astroisles.proxy.MCCoroutineSamplePlugin.<init>(AstroIslesProxy.kt:42)
[15:22:46 ERROR]:       at com.github.jsh32.astroisles.proxy.MCCoroutineSamplePlugin$$FastClassByGuice$$1948344.GUICE$TRAMPOLINE(<generated>)
[15:22:46 ERROR]:       at com.github.jsh32.astroisles.proxy.MCCoroutineSamplePlugin$$FastClassByGuice$$1948344.apply(<generated>)
[15:22:46 ERROR]:       at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:82)
[15:22:46 ERROR]:       at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114)
[15:22:46 ERROR]:       at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
[15:22:46 ERROR]:       at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)
[15:22:46 ERROR]:       at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
[15:22:46 ERROR]:       at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169)
[15:22:46 ERROR]:       at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
[15:22:46 ERROR]:       at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1101)
[15:22:46 ERROR]:       at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1139)
[15:22:46 ERROR]:       at com.velocitypowered.proxy.plugin.loader.java.JavaPluginLoader.createPlugin(JavaPluginLoader.java:124)
[15:22:46 ERROR]:       at com.velocitypowered.proxy.plugin.VelocityPluginManager.loadPlugins(VelocityPluginManager.java:155)
[15:22:46 ERROR]:       at com.velocitypowered.proxy.VelocityServer.loadPlugins(VelocityServer.java:345)
[15:22:46 ERROR]:       at com.velocitypowered.proxy.VelocityServer.start(VelocityServer.java:227)
[15:22:46 ERROR]:       at com.velocitypowered.proxy.Velocity.main(Velocity.java:69)
[15:22:46 ERROR]:       Suppressed: java.util.NoSuchElementException: No value present
[15:22:46 ERROR]:               at java.base/java.util.Optional.get(Optional.java:143)
[15:22:46 ERROR]:               at com.velocitypowered.proxy.scheduler.VelocityScheduler$TaskBuilderImpl.schedule(VelocityScheduler.java:197)
[15:22:46 ERROR]:               at com.github.shynixn.mccoroutine.velocity.dispatcher.VelocityCoroutineDispatcher.dispatch(VelocityCoroutineDispatcher.kt:28)
[15:22:46 ERROR]:               at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:322)
[15:22:46 ERROR]:               at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30)
[15:22:46 ERROR]:               ... 26 more
[15:22:46 ERROR]:       Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [com.github.shynixn.mccoroutine.velocity.impl.CoroutineSessionImpl$special$$inlined$CoroutineExceptionHandler$1@74ea46e2, StandaloneCoroutine{Cancelling}@48b4a043, VelocityCoroutineDispatcher@2f5b8250]
[15:22:46 ERROR]: Caused by: java.util.NoSuchElementException: No value present
[15:22:46 ERROR]:       at java.base/java.util.Optional.get(Optional.java:143)
[15:22:46 ERROR]:       at com.velocitypowered.proxy.scheduler.VelocityScheduler$TaskBuilderImpl.schedule(VelocityScheduler.java:197)
[15:22:46 ERROR]:       at com.github.shynixn.mccoroutine.velocity.impl.CoroutineSessionImpl$special$$inlined$CoroutineExceptionHandler$1.handleException(CoroutineExceptionHandler.kt:115)
[15:22:46 ERROR]:       at kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(CoroutineExceptionHandler.kt:25)
[15:22:46 ERROR]:       ... 34 more
[15:22:46 ERROR]: Can't create plugin mccoroutinesample
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) [Guice/ErrorInjectingConstructor]: NoSuchElementException: No value present
  at MCCoroutineSamplePlugin.<init>(AstroIslesProxy.kt:41)
  at VelocityPluginModule.configure(VelocityPluginModule.java:49)
  while locating MCCoroutineSamplePlugin

Learn more:
  https://github.com/google/guice/wiki/ERROR_INJECTING_CONSTRUCTOR

1 error

======================
Full classname legend:
======================
MCCoroutineSamplePlugin: "com.github.jsh32.astroisles.proxy.MCCoroutineSamplePlugin"
VelocityPluginModule:    "com.velocitypowered.proxy.plugin.loader.java.VelocityPluginModule"
========================
End of classname legend:
========================

        at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:251) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1104) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1139) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.velocitypowered.proxy.plugin.loader.java.JavaPluginLoader.createPlugin(JavaPluginLoader.java:124) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.velocitypowered.proxy.plugin.VelocityPluginManager.loadPlugins(VelocityPluginManager.java:155) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.velocitypowered.proxy.VelocityServer.loadPlugins(VelocityServer.java:345) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.velocitypowered.proxy.VelocityServer.start(VelocityServer.java:227) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.velocitypowered.proxy.Velocity.main(Velocity.java:69) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
Caused by: java.util.NoSuchElementException: No value present
        at java.util.Optional.get(Optional.java:143) ~[?:?]
        at com.velocitypowered.proxy.scheduler.VelocityScheduler$TaskBuilderImpl.schedule(VelocityScheduler.java:197) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.github.shynixn.mccoroutine.velocity.dispatcher.VelocityCoroutineDispatcher.dispatch(VelocityCoroutineDispatcher.kt:28) ~[?:?]
        at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:322) ~[?:?]
        at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30) ~[?:?]
        at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25) ~[?:?]
        at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:110) ~[?:?]
        at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126) ~[?:?]
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56) ~[?:?]
        at kotlinx.coroutines.BuildersKt.launch(Unknown Source) ~[?:?]
        at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47) ~[?:?]
        at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source) ~[?:?]
        at com.github.shynixn.mccoroutine.velocity.impl.MCCoroutineImpl.setupCoroutineSession(MCCoroutineImpl.kt:52) ~[?:?]
        at com.github.shynixn.mccoroutine.velocity.SuspendingPluginContainer.initialize(SuspendingPluginContainer.kt:44) ~[?:?]
        at com.github.jsh32.astroisles.proxy.MCCoroutineSamplePlugin.<init>(AstroIslesProxy.kt:42) ~[?:?]
        at com.github.jsh32.astroisles.proxy.MCCoroutineSamplePlugin$$FastClassByGuice$$1948344.GUICE$TRAMPOLINE(<generated>) ~[?:?]
        at com.github.jsh32.astroisles.proxy.MCCoroutineSamplePlugin$$FastClassByGuice$$1948344.apply(<generated>) ~[?:?]
        at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:82) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1101) ~[velocity-3.2.0-SNAPSHOT-256.jar:3.2.0-SNAPSHOT (git-40b76c63-b256)]
        ... 6 more

The issue is caused by suspendingPluginContainer.initialize(this)

Should be fixed in 2.12.1