dominik-korsa / discord-integration

Spigot plugin that allows to sync messages in a Discord server and Minecraft chat
https://www.spigotmc.org/resources/discord-integration.91088/
MIT License
18 stars 3 forks source link

[Minor Bug] Multiple Emojis with the Same Name Causes Error #13

Closed techgo closed 2 years ago

techgo commented 2 years ago

This is a minor bug so I could completely understand if you do not plan on fixing this. However, I did want to bring it to your attention. (I promise it is not an intended feature this time lol)

On Discord it is possible to have multiple emojis with the same name on your server. When using this bot on a server that has multiple emojis with the same name, the bot does not function. Furthermore it is not apparently obvious why it doesn't work which may lead to someone thinking the plugin just doesn't work at all.

[01:03:50 WARN]: java.lang.IllegalArgumentException: Multiple entries with same key: true=<:true:904892144023613480> and true=<:true:906345919666094140> [01:03:50 WARN]: at com.google.common.collect.ImmutableMap.conflictException(ImmutableMap.java:376) [01:03:50 WARN]: at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:370) [01:03:50 WARN]: at com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:153) [01:03:50 WARN]: at com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:115) [01:03:50 WARN]: at com.google.common.collect.ImmutableMap$Builder.buildOrThrow(ImmutableMap.java:574) [01:03:50 WARN]: at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:538) [01:03:50 WARN]: at discord-integration-2.4.0.jar//com.dominikkorsa.discordintegration.Client.mapEmojis(Client.kt:65) [01:03:50 WARN]: at discord-integration-2.4.0.jar//com.dominikkorsa.discordintegration.Client.initEmojis(Client.kt:57) [01:03:50 WARN]: at discord-integration-2.4.0.jar//com.dominikkorsa.discordintegration.Client.access$initEmojis(Client.kt:31) [01:03:50 WARN]: at discord-integration-2.4.0.jar//com.dominikkorsa.discordintegration.Client$initEmojis$1.invokeSuspend(Client.kt) [01:03:50 WARN]: at discord-integration-2.4.0.jar//kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [01:03:50 WARN]: at discord-integration-2.4.0.jar//kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) [01:03:50 WARN]: at discord-integration-2.4.0.jar//com.github.shynixn.mccoroutine.dispatcher.AsyncCoroutineDispatcher.dispatch(AsyncCoroutineDispatcher.kt:28) [01:03:50 WARN]: at discord-integration-2.4.0.jar//kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:160) [01:03:50 WARN]: at discord-integration-2.4.0.jar//kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:406) [01:03:50 WARN]: at discord-integration-2.4.0.jar//kotlinx.coroutines.CancellableContinuationImpl.completeResume(CancellableContinuationImpl.kt:522) [01:03:50 WARN]: at discord-integration-2.4.0.jar//kotlinx.coroutines.channels.AbstractChannel$ReceiveHasNext.completeResumeReceive(AbstractChannel.kt:977) [01:03:50 WARN]: at discord-integration-2.4.0.jar//kotlinx.coroutines.channels.AbstractSendChannel.offerInternal(AbstractChannel.kt:56) [01:03:50 WARN]: at discord-integration-2.4.0.jar//kotlinx.coroutines.channels.LinkedListChannel.offerInternal(LinkedListChannel.kt:29) [01:03:50 WARN]: at discord-integration-2.4.0.jar//kotlinx.coroutines.channels.AbstractSendChannel.trySend-JP2dKIU(AbstractChannel.kt:155) [01:03:50 WARN]: at discord-integration-2.4.0.jar//kotlinx.coroutines.reactive.SubscriptionChannel.onNext(Channel.kt:114) [01:03:50 WARN]: at discord-integration-2.4.0.jar//reactor.core.publisher.StrictSubscriber.onNext(StrictSubscriber.java:89) [01:03:50 WARN]: at discord-integration-2.4.0.jar//reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:74) [01:03:50 WARN]: at discord-integration-2.4.0.jar//reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:120) [01:03:50 WARN]: at discord-integration-2.4.0.jar//reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:120) [01:03:50 WARN]: at discord-integration-2.4.0.jar//reactor.core.publisher.FluxFlatMap$FlatMapMain.tryEmit(FluxFlatMap.java:543) [01:03:50 WARN]: at discord-integration-2.4.0.jar//reactor.core.publisher.FluxFlatMap$FlatMapInner.onNext(FluxFlatMap.java:984) [01:03:50 WARN]: at discord-integration-2.4.0.jar//reactor.core.publisher.MonoPublishOn$PublishOnSubscriber.run(MonoPublishOn.java:181) [01:03:50 WARN]: at discord-integration-2.4.0.jar//reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68) [01:03:50 WARN]: at discord-integration-2.4.0.jar//reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28) [01:03:50 WARN]: at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [01:03:50 WARN]: at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [01:03:50 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [01:03:50 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [01:03:50 WARN]: at java.base/java.lang.Thread.run(Thread.java:833)

dominik-korsa commented 2 years ago

I'll try to fix it tomorrow, if it prevents the plugin from starting it's in fact a critical bug. I'll try to fix it the same way as Discord does it, that is using the ~ symbol and the variant's number, same as in the Discord app.

Thanks for bringing this issue to my attention!

dominik-korsa commented 2 years ago

Fixed in 0be433ad6cf854cfbe913aa9f4eb3ecdfb88550b, released in v2.4.1

Sorry for the wait (exactly 6 months!), I have no excuse