0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-24 12:15:17 +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

@ -1,28 +1,30 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{AB5DE676-F731-481C-909C-48905B6E5274}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClient", "TestClient\TestClient.csproj", "{6CA2B314-2D79-46DC-9706-48E003A025BD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\Shared.csproj", "{CE222C1F-FBCE-4690-BD14-B7D6290A473E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AB5DE676-F731-481C-909C-48905B6E5274}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB5DE676-F731-481C-909C-48905B6E5274}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB5DE676-F731-481C-909C-48905B6E5274}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB5DE676-F731-481C-909C-48905B6E5274}.Release|Any CPU.Build.0 = Release|Any CPU
{6CA2B314-2D79-46DC-9706-48E003A025BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CA2B314-2D79-46DC-9706-48E003A025BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CA2B314-2D79-46DC-9706-48E003A025BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CA2B314-2D79-46DC-9706-48E003A025BD}.Release|Any CPU.Build.0 = Release|Any CPU
{CE222C1F-FBCE-4690-BD14-B7D6290A473E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE222C1F-FBCE-4690-BD14-B7D6290A473E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE222C1F-FBCE-4690-BD14-B7D6290A473E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE222C1F-FBCE-4690-BD14-B7D6290A473E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{AB5DE676-F731-481C-909C-48905B6E5274}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClient", "TestClient\TestClient.csproj", "{6CA2B314-2D79-46DC-9706-48E003A025BD}"
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
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AB5DE676-F731-481C-909C-48905B6E5274}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB5DE676-F731-481C-909C-48905B6E5274}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB5DE676-F731-481C-909C-48905B6E5274}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB5DE676-F731-481C-909C-48905B6E5274}.Release|Any CPU.Build.0 = Release|Any CPU
{6CA2B314-2D79-46DC-9706-48E003A025BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CA2B314-2D79-46DC-9706-48E003A025BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CA2B314-2D79-46DC-9706-48E003A025BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CA2B314-2D79-46DC-9706-48E003A025BD}.Release|Any CPU.Build.0 = Release|Any CPU
{CE222C1F-FBCE-4690-BD14-B7D6290A473E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE222C1F-FBCE-4690-BD14-B7D6290A473E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE222C1F-FBCE-4690-BD14-B7D6290A473E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE222C1F-FBCE-4690-BD14-B7D6290A473E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

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,