0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-28 06:03:05 +00:00

Add max players command and remove savesettigns

This commit is contained in:
Sanae 2022-05-31 14:48:48 -06:00
parent 99aabeffc9
commit d898f4754b
3 changed files with 40 additions and 35 deletions

View file

@ -285,6 +285,14 @@ CommandHandler.RegisterCommand("tag", args => {
}
});
CommandHandler.RegisterCommand("maxplayers", args => {
const string optionUsage = "Valid usage: maxplayers <playercount>";
if (args.Length != 1) return optionUsage;
if (!ushort.TryParse(args[0], out ushort maxPlayers)) return optionUsage;
Settings.Instance.Server.MaxPlayers = maxPlayers;
Settings.SaveSettings();
});
CommandHandler.RegisterCommand("list", _ => $"List: {string.Join("\n\t", server.Clients.Where(x => x.Connected).Select(x => $"{x.Name} ({x.Id})"))}");
CommandHandler.RegisterCommand("flip", args => {
@ -372,11 +380,6 @@ CommandHandler.RegisterCommand("loadsettings", _ => {
return "Loaded settings.json";
});
CommandHandler.RegisterCommand("savesettings", _ => {
Settings.SaveSettings();
return "Saved settings.json";
});
Console.CancelKeyPress += (_, e) => {
e.Cancel = true;
consoleLogger.Info("Received Ctrl+C");

View file

@ -6,6 +6,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClient", "TestClient\Te
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\Shared.csproj", "{CE222C1F-FBCE-4690-BD14-B7D6290A473E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External Items", "External Items", "{38C80331-521C-4097-8652-4DF384E5B9C1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU

View file

@ -8,8 +8,8 @@ using Shared.Packet.Packets;
// Guid startId = new Guid(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
// Guid baseOtherId = Guid.Parse("8ca3fcdd-2940-1000-b5f8-579301fcbfbb");
Guid baseOtherId = Guid.Parse("d5feae62-2e71-1000-88fd-597ea147ae88");
Guid baseOtherId = Guid.Parse("8ca3fcdd-2940-1000-b5f8-579301fcbfbb");
// Guid baseOtherId = Guid.Parse("d5feae62-2e71-1000-88fd-597ea147ae88");
PacketType[] reboundPackets = {
PacketType.Player,