feat: Adds console commands (#1714)
### Summary * Adds console command support. * Adds `save`, `restart`, and `shutdown` commands.
This commit is contained in:
parent
855f8c67ae
commit
e638fb7893
5 changed files with 233 additions and 13 deletions
27
Projects/UOContent/Console/ConsoleCommands.cs
Normal file
27
Projects/UOContent/Console/ConsoleCommands.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using Server.Saves;
|
||||
|
||||
namespace Server.Misc;
|
||||
|
||||
public static class ConsoleCommands
|
||||
{
|
||||
public static void Configure()
|
||||
{
|
||||
ConsoleInputHandler.RegisterCommand(
|
||||
["save", "s"],
|
||||
"Saves the world",
|
||||
_ => Core.LoopContext.Post(AutoSave.Save)
|
||||
);
|
||||
|
||||
ConsoleInputHandler.RegisterCommand(
|
||||
["shutdown", "sh"],
|
||||
"Shuts down the server.",
|
||||
_ => Core.Kill()
|
||||
);
|
||||
|
||||
ConsoleInputHandler.RegisterCommand(
|
||||
["restart", "r"],
|
||||
"Restarts the server.",
|
||||
_ => Core.Kill(true)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ public static class AccountPrompt
|
|||
Console.Write("Do you want to create the owner account now? (y/n): ");
|
||||
|
||||
var answer = Console.ReadLine();
|
||||
if (answer is "y" or "Y")
|
||||
if (answer.InsensitiveEquals("y"))
|
||||
{
|
||||
Console.WriteLine();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue