Citizens causing all Emotes to error in console
Versions
- Client: 1.18.2
- Server: 1.18.2
- MC Cosmetics: 0.4.0
- Citizens: Latest dev build from jenkins / Latest spigot build
Issue
When trying to use an emote, the console spits out this error:
[22:21:33 ERROR]: Could not pass event InventoryClickEvent to MCCosmetics v0.4.0-dc6ff504
java.lang.IllegalStateException: channel not registered to an event loop
at io.netty.channel.AbstractChannel.eventLoop(AbstractChannel.java:164) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
at io.netty.channel.AbstractChannelHandlerContext.executor(AbstractChannelHandlerContext.java:132) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
at io.netty.channel.AbstractChannelHandlerContext.newPromise(AbstractChannelHandlerContext.java:819) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:697) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
at io.netty.channel.DefaultChannelPipeline.write(DefaultChannelPipeline.java:1010) ~[netty-all-4.1.68.Final.jar:4.1.68.Final]
at io.lumine.cosmetics.playeranimator.nms.v1_18_R2.entity.RendererImpl.sendPackets(RendererImpl.java:108) ~[MCCosmetics.jar:?]
at io.lumine.cosmetics.playeranimator.nms.v1_18_R2.entity.RendererImpl.update(RendererImpl.java:102) ~[MCCosmetics.jar:?]
at io.lumine.cosmetics.playeranimator.api.model.player.PlayerModel.update(PlayerModel.java:141) ~[MCCosmetics.jar:?]
at io.lumine.cosmetics.playeranimator.api.model.player.PlayerModel.playAnimation(PlayerModel.java:109) ~[MCCosmetics.jar:?]
at io.lumine.cosmetics.managers.gestures.CustomPlayerModel.playAnimation(CustomPlayerModel.java:31) ~[MCCosmetics.jar:?]
at io.lumine.cosmetics.managers.gestures.GestureManager.playGesture(GestureManager.java:89) ~[MCCosmetics.jar:?]
at io.lumine.cosmetics.managers.gestures.Gesture.lambda$getIcon$1(Gesture.java:73) ~[MCCosmetics.jar:?]
at io.lumine.cosmetics.utils.menu.MenuHelper$OpenMenu.lambda$handleClick$0(MenuHelper.java:270) ~[MCCosmetics.jar:?]
at java.util.Optional.ifPresent(Optional.java:178) ~[?:?]
at io.lumine.cosmetics.utils.menu.MenuHelper$OpenMenu.lambda$handleClick$1(MenuHelper.java:270) ~[MCCosmetics.jar:?]
at java.util.Optional.ifPresent(Optional.java:178) ~[?:?]
at io.lumine.cosmetics.utils.menu.MenuHelper$OpenMenu.handleClick(MenuHelper.java:270) ~[MCCosmetics.jar:?]
at io.lumine.cosmetics.utils.menu.MenuHelper$OpenMenu.handleClick(MenuHelper.java:264) ~[MCCosmetics.jar:?]
at io.lumine.cosmetics.utils.menu.MenuHelper.onClick(MenuHelper.java:112) ~[MCCosmetics.jar:?]
at com.destroystokyo.paper.event.executor.MethodHandleEventExecutor.execute(MethodHandleEventExecutor.java:37) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:git-Paper-311]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:669) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleContainerClick(ServerGamePacketListenerImpl.java:2860) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:58) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:23) ~[?:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:51) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.18.2.jar:git-Paper-311]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1399) ~[paper-1.18.2.jar:git-Paper-311]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:188) ~[paper-1.18.2.jar:git-Paper-311]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1376) ~[paper-1.18.2.jar:git-Paper-311]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1369) ~[paper-1.18.2.jar:git-Paper-311]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1347) ~[paper-1.18.2.jar:git-Paper-311]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1229) ~[paper-1.18.2.jar:git-Paper-311]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-311]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
I found the cause through binary search of plugins and any citizens plugin version I try causes this.
Edit: Citizens being installed isn't the issue. What causes it is if you try to use an emote close to any citizens npc. If i do it elsewhere it works fine!
edit 2: the PlayerAnimator class is mistaking NPCS for real players when the chunks are newly loaded and citizens hasnt got a chance to remove them from the player list yet so it's trying to send the emote packets to the NPCS as if they are real players