ListObjectivesCommand localisation and completion (#17630)
This commit is contained in:
@@ -8,12 +8,10 @@ using Robust.Shared.Console;
|
|||||||
namespace Content.Server.Objectives.Commands
|
namespace Content.Server.Objectives.Commands
|
||||||
{
|
{
|
||||||
[AdminCommand(AdminFlags.Logs)]
|
[AdminCommand(AdminFlags.Logs)]
|
||||||
public sealed class ListObjectivesCommand : IConsoleCommand
|
public sealed class ListObjectivesCommand : LocalizedCommands
|
||||||
{
|
{
|
||||||
public string Command => "lsobjectives";
|
public override string Command => "lsobjectives";
|
||||||
public string Description => "Lists all objectives in a players mind.";
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
public string Help => "lsobjectives [<username>]";
|
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
||||||
{
|
{
|
||||||
var player = shell.Player as IPlayerSession;
|
var player = shell.Player as IPlayerSession;
|
||||||
IPlayerData? data;
|
IPlayerData? data;
|
||||||
@@ -23,14 +21,14 @@ namespace Content.Server.Objectives.Commands
|
|||||||
}
|
}
|
||||||
else if (player == null || !IoCManager.Resolve<IPlayerManager>().TryGetPlayerDataByUsername(args[0], out data))
|
else if (player == null || !IoCManager.Resolve<IPlayerManager>().TryGetPlayerDataByUsername(args[0], out data))
|
||||||
{
|
{
|
||||||
shell.WriteLine("Can't find the playerdata.");
|
shell.WriteError(LocalizationManager.GetString("shell-target-player-does-not-exist"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mind = data.ContentData()?.Mind;
|
var mind = data.ContentData()?.Mind;
|
||||||
if (mind == null)
|
if (mind == null)
|
||||||
{
|
{
|
||||||
shell.WriteLine("Can't find the mind.");
|
shell.WriteError(LocalizationManager.GetString("shell-target-entity-does-not-have-message", ("missing", "mind")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,5 +44,15 @@ namespace Content.Server.Objectives.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length == 1)
|
||||||
|
{
|
||||||
|
return CompletionResult.FromHintOptions(CompletionHelper.SessionNames(), LocalizationManager.GetString("shell-argument-username-hint"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return CompletionResult.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# lsobjectives
|
||||||
|
cmd-lsobjectives-desc = Lists all objectives in a players mind.
|
||||||
|
cmd-lsobjectives-help = Usage: lsobjectives <username>
|
||||||
@@ -42,3 +42,6 @@ shell-argument-number-must-be-between = Argument {$index} must be a number betwe
|
|||||||
shell-argument-station-id-invalid = Argument {$index} must be a valid station id!
|
shell-argument-station-id-invalid = Argument {$index} must be a valid station id!
|
||||||
shell-argument-map-id-invalid = Argument {$index} must be a valid map id!
|
shell-argument-map-id-invalid = Argument {$index} must be a valid map id!
|
||||||
shell-argument-number-invalid = Argument {$index} must be a valid number!
|
shell-argument-number-invalid = Argument {$index} must be a valid number!
|
||||||
|
|
||||||
|
# Hints
|
||||||
|
shell-argument-username-hint = <username>
|
||||||
|
|||||||
Reference in New Issue
Block a user