Skip to content

Commit

Permalink
Hardcode our behavior for now
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Sep 17, 2024
1 parent a94a342 commit b6df10f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
5 changes: 5 additions & 0 deletions mod/Gangs.BaseImpl/GangCommandManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Gangs.BaseImpl;

public class GangCommandManager {

}
7 changes: 4 additions & 3 deletions mod/Gangs.BombIconPerk/BombIconBootstrap.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using GangsAPI.Services;
using CounterStrikeSharp.API.Core;
using GangsAPI.Services;
using Microsoft.Extensions.DependencyInjection;

namespace Gangs.BombIconPerk;

public class BombIconBootstrap {
public BombIconBootstrap(IServiceProvider collection) {
new BombIconCommand(collection).Start();
public BombIconBootstrap(IServiceProvider collection, BasePlugin plugin) {
new BombIconCommand(collection, plugin).Start();
collection.GetRequiredService<IPerkManager>()
.Perks.Add(new BombPerk(collection));
}
Expand Down
16 changes: 11 additions & 5 deletions mod/Gangs.BombIconPerk/BombIconCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Commands;
using GangsAPI;
using GangsAPI.Data;
using GangsAPI.Data.Command;
Expand All @@ -14,10 +15,12 @@
using GangsAPI.Services.Player;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;

namespace Gangs.BombIconPerk;

public class BombIconCommand(IServiceProvider provider) : ICommand {
public class BombIconCommand(IServiceProvider provider, BasePlugin plugin)
: ICommand {
private readonly IEcoManager eco = provider.GetRequiredService<IEcoManager>();

private readonly IGangChatPerk? gangChat =
Expand All @@ -40,16 +43,19 @@ public class BombIconCommand(IServiceProvider provider) : ICommand {

private readonly IRankManager ranks =
provider.GetRequiredService<IRankManager>();

private readonly ICommandManager commands =
provider.GetRequiredService<ICommandManager>();

public string Name => "css_bombicon";
public string[] Usage => ["<icon>"];

public void Start(BasePlugin? plugin, bool hotReload) {
Server.PrintToConsole("Registering Bomb Icon Command");
Server.PrintToConsole("Registered: " + commands.RegisterCommand(this));
public void Start() {
plugin.AddCommand("css_bombicon", "", (player, info) => {
var playerWrapper = player == null ? null : new PlayerWrapper(player);
var infoWrapper = new CommandInfoWrapper(info);
Task.Run(async () => await Execute(playerWrapper, infoWrapper));
});
}

public async Task<CommandResult> Execute(PlayerWrapper? executor,
Expand Down
2 changes: 1 addition & 1 deletion mod/Gangs.Boostrap/GangsServiceExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public void Start(BasePlugin basePlugin) {
services, services == null, API.Gangs, API.Gangs == null);
if (services == null) return;

_ = new BombIconBootstrap(services);
_ = new BombIconBootstrap(services, basePlugin);
}
}

0 comments on commit b6df10f

Please sign in to comment.