// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.core.entity.entities.player.hud;

import com.hypixel.hytale.protocol.Packet;
import com.hypixel.hytale.protocol.packets.interface_.CustomHud;
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.core.universe.PlayerRef;

public abstract class CustomUIHud
{
    @Nonnull
    private final PlayerRef playerRef;
    
    public CustomUIHud(@Nonnull final PlayerRef playerRef) {
        this.playerRef = playerRef;
    }
    
    public void show() {
        final UICommandBuilder commandBuilder = new UICommandBuilder();
        this.build(commandBuilder);
        this.update(true, commandBuilder);
    }
    
    public void update(final boolean clear, @Nonnull final UICommandBuilder commandBuilder) {
        final CustomHud customHud = new CustomHud(clear, commandBuilder.getCommands());
        this.playerRef.getPacketHandler().writeNoCache(customHud);
    }
    
    @Nonnull
    public PlayerRef getPlayerRef() {
        return this.playerRef;
    }
    
    protected abstract void build(@Nonnull final UICommandBuilder p0);
}
