private void HandleCommand(string message)
{
string[] command = message.Split(' ');
command[0] = command[0].Remove(0, 1).ToLower();
string messageSend = "";
string[] parameters = new string[0];
string accessor = command[0].ToLower();
if(command.Length > 1)
{
message = message.Substring(accessor.Length + 2);
parameters = message.Split(' ');
}
if (Commands.CommandHandler.Commands.ContainsKey(accessor))
{
Commands.CommandBase commandBase = Commands.CommandHandler.Commands[accessor];
if (PermissionLevel < commandBase.Permission)
{
SendMessage("You do not have permission to use that command!");
}
else
{
ThreadPool.QueueUserWorkItem(delegate
{
commandBase.PlayerUse(this, parameters, messageSend);
});
}
}
else
SendMessage("Command " + accessor + " does not exist!");
}