// Generated by delombok at Tue Oct 21 21:24:10 UTC 2025
package net.md_5.bungee.protocol.packet;

import io.netty.buffer.ByteBuf;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.ChatSerializer;
import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.Protocol;
import net.md_5.bungee.protocol.ProtocolConstants;

public class Kick extends DefinedPacket {
    private BaseComponent message;

    @Override
    public void read(ByteBuf buf, Protocol protocol, ProtocolConstants.Direction direction, int protocolVersion) {
        if (protocol == Protocol.LOGIN) {
            message = ChatSerializer.forVersion(protocolVersion).deserialize(readString(buf));
        } else {
            message = readBaseComponent(buf, protocolVersion);
        }
    }

    @Override
    public void write(ByteBuf buf, Protocol protocol, ProtocolConstants.Direction direction, int protocolVersion) {
        if (protocol == Protocol.LOGIN) {
            writeString(ChatSerializer.forVersion(protocolVersion).toString(message), buf);
        } else {
            writeBaseComponent(message, buf, protocolVersion);
        }
    }

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

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public BaseComponent getMessage() {
        return this.message;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setMessage(final BaseComponent message) {
        this.message = message;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public java.lang.String toString() {
        return "Kick(message=" + this.getMessage() + ")";
    }

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

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public Kick(final BaseComponent message) {
        this.message = message;
    }

    @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 Kick)) return false;
        final Kick other = (Kick) o;
        if (!other.canEqual((java.lang.Object) this)) return false;
        final java.lang.Object this$message = this.getMessage();
        final java.lang.Object other$message = other.getMessage();
        if (this$message == null ? other$message != null : !this$message.equals(other$message)) return false;
        return true;
    }

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

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        final java.lang.Object $message = this.getMessage();
        result = result * PRIME + ($message == null ? 43 : $message.hashCode());
        return result;
    }
}
