Removed old Loc.GetString() use instances (#4155)
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Content.Server.Administration;
|
||||
@@ -18,14 +18,14 @@ namespace Content.Server.Voting
|
||||
public sealed class CreateVoteCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "createvote";
|
||||
public string Description => "Creates a vote";
|
||||
public string Help => "Usage: createvote <'restart'|'preset'>";
|
||||
public string Description => Loc.GetString("create-vote-command-description");
|
||||
public string Help => Loc.GetString("create-vote-command-help");
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.WriteError("Need exactly one argument!");
|
||||
shell.WriteError(Loc.GetString("shell-need-exactly-one-argument"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Content.Server.Voting
|
||||
|
||||
if (shell.Player != null && !mgr.CanCallVote((IPlayerSession) shell.Player))
|
||||
{
|
||||
shell.WriteError("You can't call a vote right now!");
|
||||
shell.WriteError(Loc.GetString("create-vote-command-cannot-call-vote-now"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Content.Server.Voting
|
||||
mgr.CreatePresetVote((IPlayerSession?) shell.Player);
|
||||
break;
|
||||
default:
|
||||
shell.WriteError("Invalid vote type!");
|
||||
shell.WriteError(Loc.GetString("create-vote-command-invalid-vote-type"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -58,14 +58,14 @@ namespace Content.Server.Voting
|
||||
public sealed class CreateCustomCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "customvote";
|
||||
public string Description => "Creates a custom vote";
|
||||
public string Help => "customvote <title> <option1> <option2> [option3...]";
|
||||
public string Description => Loc.GetString("create-custom-command-description");
|
||||
public string Help => Loc.GetString("create-custom-command-help");
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 3 || args.Length > 10)
|
||||
{
|
||||
shell.WriteError("Need 3 to 10 arguments!");
|
||||
shell.WriteError(Loc.GetString("shell-need-between-arguments",("lower", 3), ("upper", 10)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,11 +94,11 @@ namespace Content.Server.Voting
|
||||
if (eventArgs.Winner == null)
|
||||
{
|
||||
var ties = string.Join(", ", eventArgs.Winners.Select(c => args[(int) c]));
|
||||
chatMgr.DispatchServerAnnouncement(Loc.GetString("Tie between {0}!", ties));
|
||||
chatMgr.DispatchServerAnnouncement(Loc.GetString("create-custom-command-on-finished-tie",("ties", ties)));
|
||||
}
|
||||
else
|
||||
{
|
||||
chatMgr.DispatchServerAnnouncement(Loc.GetString("{0} wins!", args[(int) eventArgs.Winner]));
|
||||
chatMgr.DispatchServerAnnouncement(Loc.GetString("create-custom-command-on-finished-win",("winner", args[(int) eventArgs.Winner])));
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -109,39 +109,39 @@ namespace Content.Server.Voting
|
||||
public sealed class VoteCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "vote";
|
||||
public string Description => "Votes on an active vote";
|
||||
public string Help => "vote <voteId> <option>";
|
||||
public string Description => Loc.GetString("vote-command-description");
|
||||
public string Help => Loc.GetString("vote-command-help");
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (shell.Player == null)
|
||||
{
|
||||
shell.WriteError("Must be a player");
|
||||
shell.WriteError(Loc.GetString("vote-command-on-execute-error-must-be-player"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length != 2)
|
||||
{
|
||||
shell.WriteError("Expected two arguments.");
|
||||
shell.WriteError(Loc.GetString("shell-wrong-arguments-number-need-specific", ("properAmount", 2), ("currentAmount", args.Length)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var voteId))
|
||||
{
|
||||
shell.WriteError("Invalid vote ID");
|
||||
shell.WriteError(Loc.GetString("vote-command-on-execute-error-invalid-vote-id"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[1], out var voteOption))
|
||||
{
|
||||
shell.WriteError("Invalid vote options");
|
||||
shell.WriteError(Loc.GetString("vote-command-on-execute-error-invalid-vote-options"));
|
||||
return;
|
||||
}
|
||||
|
||||
var mgr = IoCManager.Resolve<IVoteManager>();
|
||||
if (!mgr.TryGetVote(voteId, out var vote))
|
||||
{
|
||||
shell.WriteError("Invalid vote");
|
||||
shell.WriteError(Loc.GetString("vote-command-on-execute-error-invalid-vote"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Content.Server.Voting
|
||||
}
|
||||
else
|
||||
{
|
||||
shell.WriteError("Invalid option");
|
||||
shell.WriteError(Loc.GetString("vote-command-on-execute-error-invalid-option"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -168,8 +168,8 @@ namespace Content.Server.Voting
|
||||
public sealed class ListVotesCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "listvotes";
|
||||
public string Description => "Lists currently active votes";
|
||||
public string Help => "Usage: listvotes";
|
||||
public string Description => Loc.GetString("list-votes-command-description");
|
||||
public string Help => Loc.GetString("list-votes-command-help");
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
@@ -186,8 +186,8 @@ namespace Content.Server.Voting
|
||||
public sealed class CancelVoteCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "cancelvote";
|
||||
public string Description => "Cancels an active vote";
|
||||
public string Help => "Usage: cancelvote <id>\nYou can get the ID from the listvotes command.";
|
||||
public string Description => Loc.GetString("cancel-vote-command-description");
|
||||
public string Help => Loc.GetString("cancel-vote-command-help");
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
@@ -195,13 +195,13 @@ namespace Content.Server.Voting
|
||||
|
||||
if (args.Length < 1)
|
||||
{
|
||||
shell.WriteError("Missing ID");
|
||||
shell.WriteError(Loc.GetString("cancel-vote-command-on-execute-error-missing-vote-id"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var id) || !mgr.TryGetVote(id, out var vote))
|
||||
{
|
||||
shell.WriteError("Invalid vote ID");
|
||||
shell.WriteError(Loc.GetString("cancel-vote-command-on-execute-error-invalid-vote-id"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user