public override void RunCommand(string[] args, Optional <Player> sender) { try { string playerName = sender.IsPresent() ? sender.Get().Name : "SERVER"; string password = args.Length == 0 ? "" : args[0]; serverConfig.ChangeServerPassword(password); Log.Info($"Server password changed to \"{password}\" by {playerName}"); SendMessageToPlayer(sender, "Server password changed"); } catch (Exception ex) { Log.Error($"Error attempting to change server password", ex); } }
private void ChangeServerPassword(string password, string name) { serverConfig.ChangeServerPassword(password); Log.Info($"Server password changed to \"{password}\" by {name}"); }