// Generated by delombok at Sat Oct 04 04:46:56 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 ScoreboardDisplay extends DefinedPacket {
    /**
     * 0 = list, 1 = side, 2 = below.
     */
    private int position;
    private String name;

    @Override
    public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
        if (protocolVersion >= ProtocolConstants.MINECRAFT_1_20_2) {
            position = readVarInt(buf);
        } else {
            position = buf.readByte();
        }
        name = readString(buf);
    }

    @Override
    public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) {
        if (protocolVersion >= ProtocolConstants.MINECRAFT_1_20_2) {
            writeVarInt(position, buf);
        } else {
            buf.writeByte(position);
        }
        writeString(name, buf);
    }

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

    /**
     * 0 = list, 1 = side, 2 = below.
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int getPosition() {
        return this.position;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public String getName() {
        return this.name;
    }

    /**
     * 0 = list, 1 = side, 2 = below.
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setPosition(final int position) {
        this.position = position;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setName(final String name) {
        this.name = name;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public java.lang.String toString() {
        return "ScoreboardDisplay(position=" + this.getPosition() + ", name=" + this.getName() + ")";
    }

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

    /**
     * Creates a new {@code ScoreboardDisplay} instance.
     *
     * @param position 0 = list, 1 = side, 2 = below.
     * @param name
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public ScoreboardDisplay(final int position, final String name) {
        this.position = position;
        this.name = name;
    }

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

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

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