Skip to content

Compatability with ServerReplay #74

@senseiwells

Description

@senseiwells

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions