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

package com.hypixel.hytale.server.core.universe.world.commands.block;

import com.hypixel.hytale.server.core.command.system.CommandSender;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.command.system.arguments.system.Argument;
import com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.protocol.GameMode;
import com.hypixel.hytale.server.core.command.system.arguments.types.ArgumentType;
import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
import com.hypixel.hytale.server.core.command.system.arguments.system.RequiredArg;

public class BlockSetCommand extends SimpleBlockCommand
{
    private final RequiredArg<BlockType> blockArg;
    
    public BlockSetCommand() {
        super("set", "server.commands.block.set.desc");
        this.blockArg = this.withRequiredArg("block", "server.commands.block.set.arg.block", ArgTypes.BLOCK_TYPE_ASSET);
        this.setPermissionGroup(GameMode.Creative);
    }
    
    @Override
    protected void executeWithBlock(@Nonnull final CommandContext context, @Nonnull final WorldChunk chunk, final int x, final int y, final int z) {
        final CommandSender sender = context.sender();
        final BlockType blockType = context.get((Argument<?, BlockType>)this.blockArg);
        chunk.setBlock(x, y, z, blockType);
        sender.sendMessage(Message.translation("server.commands.block.set.success").param("x", x).param("y", y).param("z", z).param("id", blockType.getId().toString()));
    }
}
