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

package com.hypixel.hytale.server.core.command.commands.player.stats;

import com.hypixel.hytale.server.core.command.commands.world.entity.stats.EntityStatsAddCommand;
import java.util.Collections;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import javax.annotation.Nullable;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.command.system.arguments.types.ArgumentType;
import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.core.command.system.arguments.system.RequiredArg;
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractTargetPlayerCommand;

public class PlayerStatsAddCommand extends AbstractTargetPlayerCommand
{
    @Nonnull
    private final RequiredArg<String> entityStatNameArg;
    @Nonnull
    private final RequiredArg<Integer> statAmountArg;
    
    public PlayerStatsAddCommand() {
        super("add", "server.commands.player.stats.add.desc");
        this.entityStatNameArg = this.withRequiredArg("statName", "server.commands.player.stats.add.statName.desc", ArgTypes.STRING);
        this.statAmountArg = this.withRequiredArg("statAmount", "server.commands.player.stats.add.statAmount.desc", ArgTypes.INTEGER);
    }
    
    @Override
    protected void execute(@Nonnull final CommandContext context, @Nullable final Ref<EntityStore> sourceRef, @Nonnull final Ref<EntityStore> ref, @Nonnull final PlayerRef playerRef, @Nonnull final World world, @Nonnull final Store<EntityStore> store) {
        final int statAmount = this.statAmountArg.get(context);
        final String entityStat = this.entityStatNameArg.get(context);
        EntityStatsAddCommand.addEntityStat(context, Collections.singletonList(ref), statAmount, entityStat, store);
    }
}
