Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/list command kicks client if teams too large #1160

Open
willocn opened this issue Mar 18, 2023 · 3 comments
Open

/list command kicks client if teams too large #1160

willocn opened this issue Mar 18, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@willocn
Copy link

willocn commented Mar 18, 2023

On 1.8, running /list can send too large of a chat message if one of the teams is very large. Message needs to be split to stop the client from being kicked.

Here's the relevant portion of my chat logs from a match when there were 80+ players on observers:

19:09:35] [Client thread/INFO]: [CHAT] Teams:
[19:09:35] [Client thread/INFO]: [CHAT] Death: 2/2
[19:09:35] [Client thread/INFO]: [CHAT] §e+§c*Jusst_ and §2*§c*Dawthon
[19:09:35] [Client thread/INFO]: [CHAT] Runners: 1/80
[19:09:35] [Client thread/INFO]: [CHAT] abejita23
[19:09:35] [Client thread/INFO]: [CHAT] Observers: 84
[19:09:35] [Netty Epoll Client IO #1/ERROR] [FML]: NetworkDispatcher exception
io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: readerIndex(1) + length(1) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 1, widx: 1, cap: 1)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:280) ~[ByteToMessageDecoder.class:4.0.23.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:149) ~[ByteToMessageDecoder.class:4.0.23.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) [ByteToMessageDecoder.class:4.0.23.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:163) [ByteToMessageDecoder.class:4.0.23.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:4.0.23.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
	at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:150) [ReadTimeoutHandler.class:4.0.23.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [DefaultChannelPipeline.class:4.0.23.Final]
	at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.epollInReady(EpollSocketChannel.java:722) [EpollSocketChannel$EpollSocketUnsafe.class:4.0.23.Final]
	at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:326) [EpollEventLoop.class:4.0.23.Final]
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:264) [EpollEventLoop.class:4.0.23.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [SingleThreadEventExecutor$2.class:4.0.23.Final]
	at java.lang.Thread.run(Thread.java:750) [?:1.8.0_362]
Caused by: java.lang.IndexOutOfBoundsException: readerIndex(1) + length(1) exceeds writerIndex(1): UnpooledHeapByteBuf(ridx: 1, widx: 1, cap: 1)
	at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1175) ~[AbstractByteBuf.class:4.0.23.Final]
	at io.netty.buffer.AbstractByteBuf.readByte(AbstractByteBuf.java:570) ~[AbstractByteBuf.class:4.0.23.Final]
	at net.minecraft.network.PacketBuffer.readByte(SourceFile:609) ~[em.class:?]
	at net.minecraft.network.PacketBuffer.func_150792_a(SourceFile:109) ~[em.class:?]
	at net.minecraft.network.PacketBuffer.func_150789_c(SourceFile:235) ~[em.class:?]
	at net.minecraft.network.PacketBuffer.func_179258_d(SourceFile:89) ~[em.class:?]
	at net.minecraft.network.play.server.S02PacketChat.func_148837_a(SourceFile:32) ~[fy.class:?]
	at net.minecraft.util.MessageDeserializer.decode(SourceFile:40) ~[en.class:?]
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:249) ~[ByteToMessageDecoder.class:4.0.23.Final]
	... 21 more
@Pablete1234
Copy link
Member

The /list command is not actually part of PGM, i believe it may be part of community

@willocn
Copy link
Author

willocn commented Mar 18, 2023

Believe it is handled in PGM, unless there is something in community that I missed that takes precedence

public final class ListCommand {
@CommandMethod("list|who|online|ls")
@CommandDescription("View a list of online players")
public void list(CommandSender sender, Audience viewer, Match match) {
TeamMatchModule tmm = match.getModule(TeamMatchModule.class);
if (tmm != null) {
viewer.sendMessage(translatable("command.list.teams", NamedTextColor.GRAY));
tmm.getTeams()
.forEach(
team ->
sendTeamInfo(
viewer, sender, team.getName(), team.getPlayers(), team.getMaxPlayers()));
} else {
sendTeamInfo(
viewer,
sender,
translatable("command.list.participants"),
match.getParticipants(),
match.getMaxPlayers());
}
// Observers
sendTeamInfo(
viewer,
sender,
match.getDefaultParty().getName(),
match.getDefaultParty().getPlayers(),
-1);
// Total count
viewer.sendMessage(
translatable(
"command.list.online",
NamedTextColor.GRAY,
text(getSize(match.getPlayers(), false), NamedTextColor.GREEN)));
}

@Pablete1234
Copy link
Member

nvm, it seems like it was introduced in pgm during the community-two PR

@Pablete1234 Pablete1234 added the bug Something isn't working label Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants