fix(Commands): Improve Localization of commands. Standardize some behaviors. (#30362)

* I should be studying for school but that is sofucking boring, I will pass my class no matter, however getting an A might be a challenge. My gpa is important but is the tourture for 1 point of GPA worth it? The american government says yes but they are responsible for the majority of all genocides that have ever been conducted since the dawn of man

* ugh

* ugh
This commit is contained in:
Brandon Hu
2024-08-11 09:46:57 +00:00
committed by GitHub
parent e0f292921f
commit 31c5d3555e
21 changed files with 30 additions and 27 deletions

View File

@@ -17,7 +17,7 @@ public sealed class BanPanelCommand : LocalizedCommands
{ {
if (shell.Player is not { } player) if (shell.Player is not { } player)
{ {
shell.WriteError(Loc.GetString("cmd-banpanel-server")); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -17,7 +17,7 @@ namespace Content.Server.Administration.Commands
{ {
if (shell.Player is not { } player) if (shell.Player is not { } player)
{ {
shell.WriteLine("shell-server-cannot"); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -17,10 +17,9 @@ namespace Content.Server.Administration.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var player = shell.Player; if (shell.Player is not { } player)
if (player == null)
{ {
shell.WriteLine("shell-only-players-can-run-this-command"); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -15,10 +15,9 @@ public sealed class FaxUiCommand : IConsoleCommand
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var player = shell.Player; if (shell.Player is not { } player)
if (player == null)
{ {
shell.WriteLine("shell-only-players-can-run-this-command"); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -16,10 +16,9 @@ public sealed class FollowCommand : IConsoleCommand
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var player = shell.Player; if (shell.Player is not { } player)
if (player == null)
{ {
shell.WriteError(Loc.GetString("shell-only-players-can-run-this-command")); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -16,7 +16,7 @@ public sealed class OpenAdminLogsCommand : IConsoleCommand
{ {
if (shell.Player is not { } player) if (shell.Player is not { } player)
{ {
shell.WriteLine("This does not work from the server console."); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -17,7 +17,7 @@ public sealed class OpenAdminNotesCommand : IConsoleCommand
{ {
if (shell.Player is not { } player) if (shell.Player is not { } player)
{ {
shell.WriteError("This does not work from the server console."); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -28,7 +28,7 @@ public sealed class OpenUserVisibleNotesCommand : IConsoleCommand
if (shell.Player is not { } player) if (shell.Player is not { } player)
{ {
shell.WriteError("This does not work from the server console."); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Administration.Commands
{ {
if (shell.Player == null) if (shell.Player == null)
{ {
shell.WriteError(Loc.GetString("shell-only-players-can-run-this-command")); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -18,7 +18,7 @@ namespace Content.Server.Chat.Commands
{ {
if (shell.Player is not { } player) if (shell.Player is not { } player)
{ {
shell.WriteError("This command cannot be run from the server."); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Chat.Commands
{ {
if (shell.Player is not { } player) if (shell.Player is not { } player)
{ {
shell.WriteError("This command cannot be run from the server."); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -23,7 +23,7 @@ namespace Content.Server.Chat.Commands
{ {
if (shell.Player is not { } player) if (shell.Player is not { } player)
{ {
shell.WriteLine(Loc.GetString("shell-cannot-run-command-from-server")); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Chat.Commands
{ {
if (shell.Player is not { } player) if (shell.Player is not { } player)
{ {
shell.WriteError("This command cannot be run from the server."); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -17,8 +17,13 @@ namespace Content.Server.Disposal
public void Execute(IConsoleShell shell, string argStr, string[] args) public void Execute(IConsoleShell shell, string argStr, string[] args)
{ {
var player = shell.Player; if (shell.Player is not { } player)
if (player?.AttachedEntity == null) {
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}
if (player.AttachedEntity is not { } attached)
{ {
shell.WriteLine(Loc.GetString("shell-only-players-can-run-this-command")); shell.WriteLine(Loc.GetString("shell-only-players-can-run-this-command"));
return; return;

View File

@@ -23,13 +23,13 @@ namespace Content.Server.EntityList
if (shell.Player is not { } player) if (shell.Player is not { } player)
{ {
shell.WriteError("You must be a player to run this command."); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }
if (player.AttachedEntity is not {} attached) if (player.AttachedEntity is not {} attached)
{ {
shell.WriteError("You must have an entity to run this command."); shell.WriteError(Loc.GetString("shell-only-players-can-run-this-command"));
return; return;
} }

View File

@@ -19,6 +19,7 @@ namespace Content.Server.GameTicking.Commands
{ {
if (shell.Player is not { } player) if (shell.Player is not { } player)
{ {
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -42,7 +42,7 @@ namespace Content.Server.Mapping
{ {
if (shell.Player is not { } player) if (shell.Player is not { } player)
{ {
shell.WriteError(Loc.GetString("cmd-savemap-server")); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -16,6 +16,7 @@ public sealed class NPCCommand : IConsoleCommand
{ {
if (shell.Player is not { } playerSession) if (shell.Player is not { } playerSession)
{ {
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -27,7 +27,7 @@ sealed class SalvageRulerCommand : IConsoleCommand
if (shell.Player is not { } player) if (shell.Player is not { } player)
{ {
shell.WriteError(Loc.GetString("shell-only-players-can-run-this-command")); shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return; return;
} }

View File

@@ -1,4 +1,4 @@
set-outfit-command-description = Sets the outfit of the specified entity. The entity must have {INDEFINITE($requiredComponent)} {$requiredComponent} set-outfit-command-description = Sets the outfit of the specified entity. The entity must have {INDEFINITE($requiredComponent)} {$requiredComponent}
set-outfit-command-help-text = Usage: {$command} <entityUid> | {$command} <entityUid> <outfitId> set-outfit-command-help-text = Usage: {$command} <entityUid> | {$command} <entityUid> <outfitId>
set-outfit-command-is-not-player-error = This does not work from the server console. You must pass the outfit id aswell. set-outfit-command-is-not-player-error = This command requires both arguments to work from the server console.
set-outfit-command-invalid-outfit-id-error = Invalid outfit id set-outfit-command-invalid-outfit-id-error = Invalid outfit id

View File

@@ -2,7 +2,6 @@
## General ## General
shell-server-cannot = Server cannot do this.
shell-command-success = Command successful shell-command-success = Command successful
shell-invalid-command = Invalid command. shell-invalid-command = Invalid command.
shell-invalid-command-specific = Invalid {$commandName} command. shell-invalid-command-specific = Invalid {$commandName} command.