jpenilla / MiniMOTD

Minecraft server/proxy plugin to set the server list MOTD using MiniMessage for formatting, supporting RGB colors.
https://modrinth.com/plugin/minimotd
MIT License
290 stars 32 forks source link

[Bug Report] Could not pass event ServerListPingEvent to MiniMOTD v2.0.8 #112

Closed AlisaAkiron closed 2 years ago

AlisaAkiron commented 2 years ago

Describe the bug

I am using MCSManager to manage my server. I tried to use its status query function to get server ping, version and players info. The query is successful but I got the following exception printed in the terminal.

But when ping the server in the game won't get this exception.

The code of how MCSM get server info is here

[16:25:40] [Netty Epoll Server IO #3/ERROR]: Could not pass event ServerListPingEvent to MiniMOTD v2.0.8
org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:588) [spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:575) [spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.callServerListPingEvent(CraftEventFactory.java:859) [spigot-1.19-R0.1-SNAPSHOT.jar:3545-Spigot-475f600-4230f8f]
        at net.minecraft.server.network.LegacyPingHandler.channelRead(LegacyPingHandler.java:39) [spigot-1.19-R0.1-SNAPSHOT.jar:3545-Spigot-475f600-4230f8f]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) [netty-handler-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [netty-transport-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [netty-transport-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800) [netty-transport-classes-epoll-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:487) [netty-transport-classes-epoll-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:385) [netty-transport-classes-epoll-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995) [netty-common-4.1.77.Final.jar:4.1.77.Final]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.77.Final.jar:4.1.77.Final]
        at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.UnsupportedOperationException
        at org.bukkit.event.server.ServerListPingEvent.setServerIcon(ServerListPingEvent.java:142) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
        at xyz.jpenilla.minimotd.common.PingResponse.icon(PingResponse.java:69) ~[?:?]
        at xyz.jpenilla.minimotd.bukkit.PingListener.handlePing(PingListener.java:59) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
        ... 22 more

To Reproduce Steps to reproduce the behavior:

  1. Set server IP/Address and port in MCSM
  2. Click save
  3. Refresh page
  4. The server's version and player count info is shown as expected, but I long exception will also be printed in the terminal every time query.

Expected behavior The exception should not happen.

Screenshots image

Note: The left top chart show the server info. Line 4 is the player count and Line 5 is the server version. The number it shows is corrent.

Server Software and Version:

Additional context

I have other servers running without MiniMOTD installed works fine with this MCSM feature enabled.

AlisaAkiron commented 2 years ago

This is my main.conf file:

icon-enabled=true
motd-enabled=true
motds=[
    {
        icon=server-icon
        line1="<rainbow>Some message in Chinese"
        line2="<rainbow>Some message"
    }
]
player-count-settings {
    allow-exceeding-maximum=false
    disable-player-list-hover=true
    fake-players {
        fake-players="25%"
        fake-players-enabled=false
    }
    hide-player-count=false
    just-x-more-settings {
        just-x-more-enabled=false
        x-value=3
    }
    max-players=30
    max-players-enabled=false
}
jpenilla commented 2 years ago

This sounds like a spigot issue, can you test with paper? https://papermc.io/

AlisaAkiron commented 2 years ago

This sounds like a spigot issue, can you test with paper? https://papermc.io/

Test with the latest paper build. It's fine. So it might be a spigot issue.

jpenilla commented 2 years ago

Yeah, that confirms it is a spigot issue. I'll add a workaround in the next version...

jpenilla commented 2 years ago

fixed in efa0c698409b46917564d1360154b7bde32a94dc