Continue script abstraction
This commit is contained in:
@@ -17,12 +17,13 @@ namespace ReallifeGamemode.Server.Core.Commands
|
||||
private readonly ILogger logger = LogManager.GetLogger<CommandHandler>();
|
||||
|
||||
private readonly IAPI api;
|
||||
|
||||
private readonly string[] legacyCommands;
|
||||
private Random random = new Random();
|
||||
|
||||
public CommandHandler(IAPI api)
|
||||
public CommandHandler(IAPI api, string[] registeredCommands)
|
||||
{
|
||||
this.api = api;
|
||||
legacyCommands = registeredCommands;
|
||||
Main.EventHandler.RegisterClientEvent("Command", OnPlayerCommand);
|
||||
}
|
||||
|
||||
@@ -32,6 +33,11 @@ namespace ReallifeGamemode.Server.Core.Commands
|
||||
|
||||
logger.LogInformation("Player '{Name}' executed command '{command}'", player.Name, command);
|
||||
|
||||
if(legacyCommands.Contains(command))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!registeredCommands.ContainsKey(command))
|
||||
{
|
||||
player.SendMessage($"Der Befehl ~b~/{command}~s~ existiert nicht", ChatPrefix.Error);
|
||||
|
||||
Reference in New Issue
Block a user