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

Compatability with ServerReplay #74

Open
senseiwells opened this issue Jun 17, 2024 · 0 comments
Open

Compatability with ServerReplay #74

senseiwells opened this issue Jun 17, 2024 · 0 comments

Comments

@senseiwells
Copy link

ServerReplay is an implementation of ReplayMod for the server side and records all outgoing packets to the client.

Due to how Syncmatica sends packets this causes an incompatability: senseiwells/ServerReplay#23.
The first issue is that the CustomPayloads that Syncmatica uses stores the raw PacketByteBuf data, when the payload is written it consumes all the bytes from the payload subsequently making the payload useless. ServerReplay writes a copy of all packets to disk before the packets are sent to the client, because of this ServerReplay will consume the packet and when the packet tries to get sent to the client it is empty.

A simple fix would be to just copy the bytes when writing:

@Override
public void write(PacketByteBuf buf) {
    buf.writeBytes(byteBuf.copy());
}

While not directly related to the issue above, I thought I'd mention as this may cause compatibility issues with other mods:

Another issue that I've had with Syncmatica is that it sends packet during the construction of the server network handler. This is problematic as it can cause this to be leaked - if others extend the network handler their objects will not be initialised before the method is caused which can lead to NPEs.

Please consider moving this to another hook, for example the tail of PlayerManager#onPlayerConnect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant