Play time tracking: Job timers 3: more titles: when the (#9978)

Co-authored-by: Veritius <veritiusgaming@gmail.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Pieter-Jan Briers
2022-08-07 08:00:42 +02:00
committed by GitHub
parent 6b94db0336
commit e852ada6c8
91 changed files with 5044 additions and 247 deletions

View File

@@ -8,13 +8,14 @@ namespace Content.Server.Afk
[AdminCommand(AdminFlags.Admin)]
public sealed class IsAfkCommand : IConsoleCommand
{
[Dependency] private readonly IPlayerManager _players = default!;
public string Command => "isafk";
public string Description => "Checks if a specified player is AFK";
public string Help => "Usage: isafk <playerName>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var playerManager = IoCManager.Resolve<IPlayerManager>();
var afkManager = IoCManager.Resolve<IAfkManager>();
if (args.Length == 0)
@@ -23,7 +24,7 @@ namespace Content.Server.Afk
return;
}
if (!playerManager.TryGetSessionByUsername(args[0], out var player))
if (!_players.TryGetSessionByUsername(args[0], out var player))
{
shell.WriteError("Unable to find that player");
return;
@@ -31,5 +32,17 @@ namespace Content.Server.Afk
shell.WriteLine(afkManager.IsAfk(player) ? "They are indeed AFK" : "They are not AFK");
}
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
{
if (args.Length == 1)
{
return CompletionResult.FromHintOptions(
CompletionHelper.SessionNames(players: _players),
"<playerName>");
}
return CompletionResult.Empty;
}
}
}