using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Svelto.ECS;
namespace GamecraftModdingAPI.Commands
{
///
/// A simple implementation of ICustomCommandEngine sufficient for most commands.
/// This version is for commands which take 1 argument(s)
///
public class SimpleCustomCommandEngine : ICustomCommandEngine
{
public string Name { get; }
public string Description { get; }
private Action runCommand;
public IEntitiesDB entitiesDB { set; private get; }
public void Dispose()
{
CommandRegistrationHelper.Unregister(this.Name);
}
public void Ready()
{
CommandRegistrationHelper.Register(this.Name, this.runCommand, this.Description);
}
///
/// Construct the engine
///
/// The command's operation
/// The name of the command
/// The command's description, shown in command help messages
public SimpleCustomCommandEngine(Action command, string name, string description)
{
this.runCommand = command;
this.Name = name;
this.Description = description;
}
}
}