Refactor fun commands to external module

Commented out fun command implementations (noclip, godmode, freeze, unfreeze, resize) in funcommands.cs and removed their registration from RegisterCommands.cs. These commands are now intended to be provided by the new CS2-SimpleAdmin_FunCommands external module, improving modularity and maintainability.
This commit is contained in:
Dawid Bepierszcz
2025-10-19 03:12:58 +02:00
parent 2edacc2b3f
commit 78318102fe
69 changed files with 5943 additions and 1493 deletions

View File

@@ -1,6 +1,7 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Capabilities;
using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Commands.Targeting;
using CounterStrikeSharp.API.Modules.Entities;
namespace CS2_SimpleAdminApi;
@@ -8,6 +9,8 @@ namespace CS2_SimpleAdminApi;
public interface ICS2_SimpleAdminApi
{
public static readonly PluginCapability<ICS2_SimpleAdminApi?> PluginCapability = new("simpleadmin:api");
public event Action? OnSimpleAdminReady;
/// <summary>
/// Gets player information associated with the specified player controller.
@@ -83,6 +86,25 @@ public interface ICS2_SimpleAdminApi
/// </summary>
public void ShowAdminActivity(string messageKey, string? callerName = null, bool dontPublish = false, params object[] messageArgs);
/// <summary>
/// Shows an admin activity message with a custom translated message (for modules with their own localizer).
/// </summary>
/// <param name="translatedMessage">Already translated message to display to players.</param>
/// <param name="callerName">Name of the admin executing the action (optional).</param>
/// <param name="dontPublish">If true, won't trigger publish events.</param>
public void ShowAdminActivityTranslated(string translatedMessage, string? callerName = null, bool dontPublish = false);
/// <summary>
/// Shows an admin activity message using module's localizer for per-player language support.
/// This method sends messages in each player's configured language.
/// </summary>
/// <param name="moduleLocalizer">The module's IStringLocalizer instance.</param>
/// <param name="messageKey">The translation key from the module's lang files.</param>
/// <param name="callerName">Name of the admin executing the action (optional).</param>
/// <param name="dontPublish">If true, won't trigger publish events.</param>
/// <param name="messageArgs">Arguments to format the localized message.</param>
public void ShowAdminActivityLocalized(object moduleLocalizer, string messageKey, string? callerName = null, bool dontPublish = false, params object[] messageArgs);
/// <summary>
/// Returns true if the specified admin player is in silent mode (not broadcasting activity).
/// </summary>
@@ -102,4 +124,54 @@ public interface ICS2_SimpleAdminApi
/// Unregisters an existing command by its name.
/// </summary>
public void UnRegisterCommand(string name);
/// <summary>
/// Gets target players from command
/// </summary>
TargetResult? GetTarget(CommandInfo command);
/// <summary>
/// Returns the list of current valid players, available to call from other plugins.
/// </summary>
List<CCSPlayerController> GetValidPlayers();
/// <summary>
/// Registers a menu category.
/// </summary>
void RegisterMenuCategory(string categoryId, string categoryName, string permission = "@css/generic");
/// <summary>
/// Registers a menu in a category.
/// </summary>
void RegisterMenu(string categoryId, string menuId, string menuName, Func<CCSPlayerController, object> menuFactory, string? permission = null);
/// <summary>
/// Unregisters a menu from a category.
/// </summary>
void UnregisterMenu(string categoryId, string menuId);
/// <summary>
/// Creates a menu with an automatic back button.
/// </summary>
object CreateMenuWithBack(string title, string categoryId, CCSPlayerController player);
/// <summary>
/// Creates a menu with a list of players with filter and action.
/// </summary>
object CreateMenuWithPlayers(string title, string categoryId, CCSPlayerController admin, Func<CCSPlayerController, bool> filter, Action<CCSPlayerController, CCSPlayerController> onSelect);
/// <summary>
/// Adds an option to the menu (extension method helper).
/// </summary>
void AddMenuOption(object menu, string name, Action<CCSPlayerController> action, bool disabled = false, string? permission = null);
/// <summary>
/// Adds a submenu to the menu (extension method helper).
/// </summary>
void AddSubMenu(object menu, string name, Func<CCSPlayerController, object> subMenuFactory, bool disabled = false, string? permission = null);
/// <summary>
/// Opens a menu for a player.
/// </summary>
void OpenMenu(object menu, CCSPlayerController player);
}