make database seed code less verbose
disable killserver command fix issue with default parser not saving during setup fix issue with unban reason displayed when player is rebanned
This commit is contained in:
parent
599a14b646
commit
2cceb2f3e7
@ -387,7 +387,7 @@ namespace IW4MAdmin.Application
|
||||
Commands.Add(new CIP());
|
||||
Commands.Add(new CMask());
|
||||
Commands.Add(new CPruneAdmins());
|
||||
Commands.Add(new CKillServer());
|
||||
//Commands.Add(new CKillServer());
|
||||
Commands.Add(new CSetPassword());
|
||||
Commands.Add(new CPing());
|
||||
Commands.Add(new CSetGravatar());
|
||||
|
@ -1135,12 +1135,12 @@ namespace SharedLibraryCore.Commands
|
||||
|
||||
public override async Task ExecuteAsync(GameEvent E)
|
||||
{
|
||||
if (E.Owner.ServerConfig.ManualLogPath != null)
|
||||
if (E.Owner.ServerConfig.GameLogServerUrl != null)
|
||||
{
|
||||
using (var wc = new WebClient())
|
||||
{
|
||||
E.Owner.RestartRequested = true;
|
||||
var response = await wc.DownloadStringTaskAsync(new Uri($"{E.Owner.ServerConfig.ManualLogPath}/restart"));
|
||||
var response = await wc.DownloadStringTaskAsync(new Uri($"{E.Owner.ServerConfig.GameLogServerUrl}/restart"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@ namespace SharedLibraryCore.Configuration
|
||||
{
|
||||
public class QuickMessageConfiguration
|
||||
{
|
||||
|
||||
public Game Game { get; set; }
|
||||
public Dictionary<string, string> Messages { get; set; }
|
||||
}
|
||||
|
@ -58,11 +58,11 @@ namespace SharedLibraryCore.Configuration
|
||||
var parserVersions = rconParsers.Select(_parser => _parser.Version).ToArray();
|
||||
var selection = Utilities.PromptSelection($"{loc["SETUP_SERVER_RCON_PARSER_VERSION"]} ({IPAddress}:{Port})", $"{loc["SETUP_PROMPT_DEFAULT"]} (Call of Duty)", null, parserVersions);
|
||||
|
||||
if (selection.Item1 > 0)
|
||||
if (selection.Item1 >= 0)
|
||||
{
|
||||
RConParserVersion = selection.Item2;
|
||||
|
||||
if (!rconParsers[selection.Item1 - 1].CanGenerateLogPath)
|
||||
if (selection.Item1 > 0 && !rconParsers[selection.Item1 - 1].CanGenerateLogPath)
|
||||
{
|
||||
Console.WriteLine(loc["SETUP_SERVER_NO_LOG"]);
|
||||
ManualLogPath = Utilities.PromptString(loc["SETUP_SERVER_LOG_PATH"]);
|
||||
@ -72,7 +72,7 @@ namespace SharedLibraryCore.Configuration
|
||||
parserVersions = eventParsers.Select(_parser => _parser.Version).ToArray();
|
||||
selection = Utilities.PromptSelection($"{loc["SETUP_SERVER_EVENT_PARSER_VERSION"]} ({IPAddress}:{Port})", $"{loc["SETUP_PROMPT_DEFAULT"]} (Call of Duty)", null, parserVersions);
|
||||
|
||||
if (selection.Item1 > 0)
|
||||
if (selection.Item1 >= 0)
|
||||
{
|
||||
EventParserVersion = selection.Item2;
|
||||
}
|
||||
|
@ -18,27 +18,11 @@ namespace SharedLibraryCore.Database
|
||||
|
||||
public async Task Seed()
|
||||
{
|
||||
// make sure database exists
|
||||
//context.Database.EnsureCreated();
|
||||
context.Database.Migrate();
|
||||
|
||||
if (context.AliasLinks.Count() == 0)
|
||||
{
|
||||
context.AliasLinks.Add(new EFAliasLink()
|
||||
{
|
||||
AliasLinkId = 1
|
||||
});
|
||||
|
||||
var currentAlias = new EFAlias()
|
||||
{
|
||||
AliasId = 1,
|
||||
Active = true,
|
||||
DateAdded = DateTime.UtcNow,
|
||||
Name = "IW4MAdmin",
|
||||
LinkId = 1
|
||||
};
|
||||
|
||||
context.Aliases.Add(currentAlias);
|
||||
var link = new EFAliasLink();
|
||||
|
||||
context.Clients.Add(new EFClient()
|
||||
{
|
||||
@ -50,8 +34,14 @@ namespace SharedLibraryCore.Database
|
||||
Level = Permission.Console,
|
||||
Masked = true,
|
||||
NetworkId = 0,
|
||||
AliasLinkId = 1,
|
||||
CurrentAliasId = 1,
|
||||
AliasLink = link,
|
||||
CurrentAlias = new EFAlias()
|
||||
{
|
||||
Link = link,
|
||||
Active = true,
|
||||
DateAdded = DateTime.UtcNow,
|
||||
Name = "IW4MAdmin",
|
||||
},
|
||||
});
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
|
@ -538,7 +538,7 @@ namespace SharedLibraryCore.Database.Models
|
||||
// kick them as their level is banned
|
||||
if (Level == Permission.Banned)
|
||||
{
|
||||
var profileBan = ReceivedPenalties.FirstOrDefault(_penalty => _penalty.Expires == null && _penalty.Active);
|
||||
var profileBan = ReceivedPenalties.FirstOrDefault(_penalty => _penalty.Expires == null && _penalty.Active && _penalty.Type == Penalty.PenaltyType.Ban);
|
||||
|
||||
if (profileBan == null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user