public static void OnExcecuteEnd(IRocketPlayer player, string command) { lock (Awaiters) { if (Awaiters.ContainsKey(player.Id)) { CommandAwaiter awaiter = Awaiters[player.Id]; Awaiters.Remove(player.Id); awaiter.SendComplete(true); } } }
public static void OnExcecuteStart(IRocketPlayer player, string command) { CommandAwaiter awaiter = new CommandAwaiter(player, command); awaiter.SendStarted(); awaiter.OnComplete = OnAwaiterFinished; lock (Awaiters) { if (!Awaiters.ContainsKey(player.Id)) { Awaiters.Add(player.Id, awaiter); } } }
public static void OnAwaiterFinished(CommandAwaiter awaiter) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"[UnturnedPluginProfiler] Command [{awaiter.Command}] took {Math.Round(awaiter.TotalMS, 2)}ms ({awaiter.TotalTicks} ticks), executor: {awaiter.Player.DisplayName}"); Console.ResetColor(); }