// Generated by delombok at Tue Dec 16 19:35:15 UTC 2025
package net.md_5.bungee.protocol.packet;

import io.netty.buffer.ByteBuf;
import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.ProtocolConstants;

public class KeepAlive extends DefinedPacket {
    private long randomId;

    @Override
    public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
        randomId = (protocolVersion >= ProtocolConstants.MINECRAFT_1_12_2) ? buf.readLong() : readVarInt(buf);
    }

    @Override
    public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
        if (protocolVersion >= ProtocolConstants.MINECRAFT_1_12_2) {
            buf.writeLong(randomId);
        } else {
            writeVarInt((int) randomId, buf);
        }
    }

    @Override
    public void handle(AbstractPacketHandler handler) throws Exception {
        handler.handle(this);
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public long getRandomId() {
        return this.randomId;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setRandomId(final long randomId) {
        this.randomId = randomId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public java.lang.String toString() {
        return "KeepAlive(randomId=" + this.getRandomId() + ")";
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public KeepAlive() {
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public KeepAlive(final long randomId) {
        this.randomId = randomId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public boolean equals(final java.lang.Object o) {
        if (o == this) return true;
        if (!(o instanceof KeepAlive)) return false;
        final KeepAlive other = (KeepAlive) o;
        if (!other.canEqual((java.lang.Object) this)) return false;
        if (this.getRandomId() != other.getRandomId()) return false;
        return true;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    protected boolean canEqual(final java.lang.Object other) {
        return other instanceof KeepAlive;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        final long $randomId = this.getRandomId();
        result = result * PRIME + (int) ($randomId >>> 32 ^ $randomId);
        return result;
    }
}
