Files
Gangs/Commands/CommandManager.cs
Isaac 11ffe34855 Dev (#9)
* Normalize paths

* Update workflows

* Update workflows

* Update workflows

* Update csproj build dirs

* Update csproj build dirs

* Fix bugs

* Directories are hard

* Dont zip zip

* Rename to support CS#

* Fix nightly file name

* Debug

* Try referencing class directly

* Update dependabot

* Update gitignore and command tests

* More tests:

* Basic gang creation working
2024-09-02 21:00:25 -07:00

34 lines
948 B
C#

using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using GangsAPI;
using GangsAPI.Data;
using GangsAPI.Data.Command;
using GangsAPI.Services;
using GangsAPI.Services.Commands;
using Mock;
namespace Commands;
public class CommandManager(IGangManager gangMgr)
: MockCommandManager, IPluginBehavior {
private BasePlugin? plugin;
public void Start(BasePlugin? basePlugin, bool hotReload) {
plugin = basePlugin;
RegisterCommand(new GangCommand(gangMgr));
}
public override bool RegisterCommand(ICommand command) {
base.RegisterCommand(command);
plugin?.AddCommand(command.Name, command.Description ?? string.Empty,
(player, info) => {
var wrapper = player == null ? null : new PlayerWrapper(player);
var args = info.GetCommandString.Split(" ");
Server.NextFrameAsync(async () => {
await ProcessCommand(wrapper, args);
});
});
return true;
}
}