mirror of
https://github.com/edgegamers/Gangs.git
synced 2025-12-05 20:40:30 -08:00
* 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
34 lines
948 B
C#
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;
|
|
}
|
|
} |