Continue script abstraction

This commit is contained in:
hydrant
2020-03-01 13:15:50 +01:00
parent 37f499a446
commit d7a76caf2a
14 changed files with 531 additions and 8 deletions

View File

@@ -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);