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

package com.hypixel.hytale.server.npc.corecomponents.lifecycle.builders;

import com.hypixel.hytale.server.npc.asset.builder.Builder;
import com.google.gson.JsonElement;
import com.hypixel.hytale.server.npc.asset.builder.BuilderDescriptorState;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.npc.corecomponents.lifecycle.ActionDespawn;
import com.hypixel.hytale.server.npc.asset.builder.BuilderSupport;
import com.hypixel.hytale.server.npc.corecomponents.builders.BuilderActionBase;

public class BuilderActionDespawn extends BuilderActionBase
{
    protected boolean force;
    
    @Nonnull
    @Override
    public ActionDespawn build(final BuilderSupport builderSupport) {
        return new ActionDespawn(this);
    }
    
    @Nonnull
    @Override
    public String getShortDescription() {
        return "Trigger the NPC to despawn";
    }
    
    @Nonnull
    @Override
    public String getLongDescription() {
        return "Trigger the NPC to start the despawning cycle. If the script contains a despawn sensor it will run that action/motion before removing.";
    }
    
    @Nonnull
    @Override
    public BuilderDescriptorState getBuilderDescriptorState() {
        return BuilderDescriptorState.Stable;
    }
    
    @Nonnull
    @Override
    public BuilderActionDespawn readConfig(@Nonnull final JsonElement data) {
        this.getBoolean(data, "Force", b -> this.force = b, false, BuilderDescriptorState.Stable, "Force the NPC to remove automatically", null);
        return this;
    }
    
    public boolean isForced() {
        return this.force;
    }
}
