Fix bug introduced with auto messages
This commit is contained in:
parent
5d41059641
commit
74cdf8e885
@ -6,7 +6,7 @@
|
|||||||
<RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion>
|
<RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion>
|
||||||
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
||||||
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
||||||
<Version>2.2.5.3</Version>
|
<Version>2.2.5.4</Version>
|
||||||
<Authors>RaidMax</Authors>
|
<Authors>RaidMax</Authors>
|
||||||
<Company>Forever None</Company>
|
<Company>Forever None</Company>
|
||||||
<Product>IW4MAdmin</Product>
|
<Product>IW4MAdmin</Product>
|
||||||
@ -31,8 +31,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||||
<TieredCompilation>true</TieredCompilation>
|
<TieredCompilation>true</TieredCompilation>
|
||||||
<AssemblyVersion>2.2.5.3</AssemblyVersion>
|
<AssemblyVersion>2.2.5.4</AssemblyVersion>
|
||||||
<FileVersion>2.2.5.3</FileVersion>
|
<FileVersion>2.2.5.4</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -978,10 +978,10 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
override public void InitializeTokens()
|
override public void InitializeTokens()
|
||||||
{
|
{
|
||||||
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("TOTALPLAYERS", (Server s) => Task.Run(() => (object)Manager.GetClientService().GetTotalClientsAsync())));
|
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("TOTALPLAYERS", (Server s) => Task.Run(async () => (await Manager.GetClientService().GetTotalClientsAsync()).ToString())));
|
||||||
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("VERSION", (Server s) => Task.Run(() => (object)Application.Program.Version.ToString())));
|
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("VERSION", (Server s) => Task.FromResult(Application.Program.Version.ToString())));
|
||||||
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("NEXTMAP", (Server s) => Task.Run(() => (object)SharedLibraryCore.Commands.CNextMap.GetNextMap(s))));
|
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("NEXTMAP", (Server s) => SharedLibraryCore.Commands.CNextMap.GetNextMap(s)));
|
||||||
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("ADMINS", (Server s) => Task.Run(() => (object)SharedLibraryCore.Commands.CListAdmins.OnlineAdmins(s))));
|
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("ADMINS", (Server s) => Task.FromResult(SharedLibraryCore.Commands.CListAdmins.OnlineAdmins(s))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,11 @@ namespace AutomessageFeed
|
|||||||
public IBaseConfiguration Generate()
|
public IBaseConfiguration Generate()
|
||||||
{
|
{
|
||||||
EnableFeed = Utilities.PromptBool(Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_AUTOMESSAGEFEED_PROMPT_ENABLE"]);
|
EnableFeed = Utilities.PromptBool(Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_AUTOMESSAGEFEED_PROMPT_ENABLE"]);
|
||||||
|
|
||||||
|
if (EnableFeed)
|
||||||
|
{
|
||||||
FeedUrl = Utilities.PromptString(Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_AUTOMESSAGEFEED_URL"]);
|
FeedUrl = Utilities.PromptString(Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_AUTOMESSAGEFEED_URL"]);
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace AutomessageFeed
|
|||||||
private Configuration _configuration;
|
private Configuration _configuration;
|
||||||
private int _currentFeedItem;
|
private int _currentFeedItem;
|
||||||
|
|
||||||
private async Task<object> GetNextFeedItem(Server server)
|
private async Task<string> GetNextFeedItem(Server server)
|
||||||
{
|
{
|
||||||
var items = new List<string>();
|
var items = new List<string>();
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ namespace IW4MAdmin.Plugins.Stats
|
|||||||
|
|
||||||
MetaService.AddMeta(getMessages);
|
MetaService.AddMeta(getMessages);
|
||||||
|
|
||||||
async Task<object> totalKills(Server server)
|
async Task<string> totalKills(Server server)
|
||||||
{
|
{
|
||||||
using (var ctx = new DatabaseContext(disableTracking: true))
|
using (var ctx = new DatabaseContext(disableTracking: true))
|
||||||
{
|
{
|
||||||
@ -300,7 +300,7 @@ namespace IW4MAdmin.Plugins.Stats
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<object> totalPlayTime(Server server)
|
async Task<string> totalPlayTime(Server server)
|
||||||
{
|
{
|
||||||
using (var ctx = new DatabaseContext(disableTracking: true))
|
using (var ctx = new DatabaseContext(disableTracking: true))
|
||||||
{
|
{
|
||||||
@ -309,14 +309,14 @@ namespace IW4MAdmin.Plugins.Stats
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<object> topStats(Server s)
|
async Task<string> topStats(Server s)
|
||||||
{
|
{
|
||||||
return String.Join(Environment.NewLine, await Commands.TopStats.GetTopStats(s));
|
return string.Join(Environment.NewLine, await Commands.TopStats.GetTopStats(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<object> mostPlayed(Server s)
|
async Task<string> mostPlayed(Server s)
|
||||||
{
|
{
|
||||||
return String.Join(Environment.NewLine, await Commands.MostPlayed.GetMostPlayed(s));
|
return string.Join(Environment.NewLine, await Commands.MostPlayed.GetMostPlayed(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
manager.GetMessageTokens().Add(new MessageToken("TOTALKILLS", totalKills));
|
manager.GetMessageTokens().Add(new MessageToken("TOTALKILLS", totalKills));
|
||||||
|
@ -17,6 +17,7 @@ namespace SharedLibraryCore.Dtos
|
|||||||
public List<string> Aliases { get; set; }
|
public List<string> Aliases { get; set; }
|
||||||
public List<string> IPs { get; set; }
|
public List<string> IPs { get; set; }
|
||||||
public bool HasActivePenalty { get; set; }
|
public bool HasActivePenalty { get; set; }
|
||||||
|
public string ActivePenaltyType { get; set; }
|
||||||
public int ConnectionCount { get; set; }
|
public int ConnectionCount { get; set; }
|
||||||
public string LastSeen { get; set; }
|
public string LastSeen { get; set; }
|
||||||
public string FirstSeen { get; set; }
|
public string FirstSeen { get; set; }
|
||||||
|
@ -7,18 +7,19 @@ namespace SharedLibraryCore.Helpers
|
|||||||
public class MessageToken
|
public class MessageToken
|
||||||
{
|
{
|
||||||
public string Name { get; private set; }
|
public string Name { get; private set; }
|
||||||
private readonly Func<Server, Task<object>> _asyncValue;
|
private readonly Func<Server, Task<string>> _asyncValue;
|
||||||
|
|
||||||
|
|
||||||
public MessageToken(string Name, Func<Server, Task<object>> Value)
|
public MessageToken(string Name, Func<Server, Task<string>> Value)
|
||||||
{
|
{
|
||||||
this.Name = Name;
|
this.Name = Name;
|
||||||
_asyncValue = Value;
|
_asyncValue = Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<object> ProcessAsync(Server server)
|
public async Task<string> ProcessAsync(Server server)
|
||||||
{
|
{
|
||||||
return _asyncValue(server);
|
string result = await _asyncValue(server);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ namespace SharedLibraryCore
|
|||||||
|
|
||||||
if (found != null)
|
if (found != null)
|
||||||
{
|
{
|
||||||
str = str.Replace(Match, (await found.ProcessAsync(server)).ToString());
|
str = str.Replace(Match, await found.ProcessAsync(server));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ namespace WebfrontCore.Controllers
|
|||||||
.OrderBy(i => i)
|
.OrderBy(i => i)
|
||||||
.ToList(),
|
.ToList(),
|
||||||
HasActivePenalty = activePenalties.Count > 0,
|
HasActivePenalty = activePenalties.Count > 0,
|
||||||
|
ActivePenaltyType = activePenalties.Count > 0 ? activePenalties.First().Type.ToString() : null,
|
||||||
Online = Manager.GetActiveClients().FirstOrDefault(c => c.ClientId == client.ClientId) != null,
|
Online = Manager.GetActiveClients().FirstOrDefault(c => c.ClientId == client.ClientId) != null,
|
||||||
TimeOnline = (DateTime.UtcNow - client.LastConnection).TimeSpanText(),
|
TimeOnline = (DateTime.UtcNow - client.LastConnection).TimeSpanText(),
|
||||||
LinkedAccounts = client.LinkedAccounts
|
LinkedAccounts = client.LinkedAccounts
|
||||||
|
Loading…
Reference in New Issue
Block a user