All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minestom.server.crypto.SignedMessageHeader Maven / Gradle / Ivy

There is a newer version: 7320437640
Show newest version
package net.minestom.server.crypto;

import net.minestom.server.network.NetworkBuffer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.UUID;

public record SignedMessageHeader(@Nullable MessageSignature previousSignature,
                                  @NotNull UUID sender) implements NetworkBuffer.Writer {
    public SignedMessageHeader(@NotNull NetworkBuffer reader) {
        this(reader.readOptional(MessageSignature::new), reader.read(NetworkBuffer.UUID));
    }

    @Override
    public void write(@NotNull NetworkBuffer writer) {
        writer.writeOptional(previousSignature);
        writer.write(NetworkBuffer.UUID, sender);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy