mirror of
https://git.battle-of-pip.de/root/vpr-mitarbeiterverwaltung.git
synced 2025-12-13 22:31:38 +01:00
First Server Test | Next Update: Change Commands to Attributes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using DX86;
|
||||
using Server.Commands;
|
||||
|
||||
@@ -32,15 +33,22 @@ public class CommandManager
|
||||
}
|
||||
}
|
||||
|
||||
public void ExecuteCommand(string executor, TcpClient? client = null, TcpServer? clientSocket = null, params string[] args)
|
||||
public void ExecuteCommand(string executor, TcpClient? client = null, TcpServer? clientSocket = null, string cid = "", params string[] args)
|
||||
{
|
||||
if (_commands.TryGetValue(executor, out var command))
|
||||
{
|
||||
command.Exec(args:args, client:client, clientSocket:clientSocket);
|
||||
JsonMessage returnMessage = new JsonMessage();
|
||||
returnMessage.cid = cid;
|
||||
returnMessage.cmd = command.Exec(args:args, client:client, clientSocket:clientSocket);
|
||||
|
||||
string sendClientMessage = JsonSerializer.Serialize(returnMessage);
|
||||
|
||||
clientSocket.SendMessageAsync(client:client, message:sendClientMessage+"\n");
|
||||
//clientSocket.SendMessageAsync(client:client, message:command.Exec(args:args, client:client, clientSocket:clientSocket));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Command '{executor}' not found.");
|
||||
Program.messageSender.Log($"[COMMANDMANAGER] Command '{executor}' not found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user