Added IManager parameter to IPlugin.OnLoadAsync
This commit is contained in:
parent
4c813b18d6
commit
c19d6e98f5
@ -85,7 +85,7 @@ namespace IW4MAdmin
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Plugin.OnLoadAsync();
|
Plugin.OnLoadAsync(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
Binary file not shown.
@ -2,7 +2,7 @@
|
|||||||
function getPlayerHistoryChart(playerHistory, i) {
|
function getPlayerHistoryChart(playerHistory, i) {
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
|
||||||
// thanks to cnavas js :(
|
// thanks to canvasjs :(
|
||||||
playerHistory.forEach(function(item, i) {
|
playerHistory.forEach(function(item, i) {
|
||||||
playerHistory[i].x = new Date(playerHistory[i].x);
|
playerHistory[i].x = new Date(playerHistory[i].x);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div id="stats">
|
<div id="stats">
|
||||||
<div id="stats-info">
|
<div id="stats-info">
|
||||||
<input type="range" min="1" max="1000" value="100" class="slider" id="KillEventCount">
|
<input type="range" min="1" max="2500" value="100" class="slider" id="KillEventCount">
|
||||||
<label for="KillEventCount">Showing 100 Kills</label>
|
<label for="KillEventCount">Showing 100 Kills</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -135,8 +135,8 @@
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('#KillEventCount').on('input change', function () {
|
$('#KillEventCount').on('input change', function () {
|
||||||
$(this).next().text('Showing ' + $(this).val() + ' Kills');
|
$(this).next().text('Showing ' + $(this).val() + ' Kills');
|
||||||
if ($(this).val() > 300)
|
if ($(this).val() > 999)
|
||||||
refreshInterval = 500;
|
refreshInterval = 5000;
|
||||||
else
|
else
|
||||||
refreshInterval = 250;
|
refreshInterval = 250;
|
||||||
});
|
});
|
||||||
|
@ -95,7 +95,7 @@ namespace EventAPI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task OnLoadAsync()
|
public async Task OnLoadAsync(IManager manager)
|
||||||
{
|
{
|
||||||
APIEvents = new Queue<RestEvent>();
|
APIEvents = new Queue<RestEvent>();
|
||||||
flaggedMessagesText = new List<string>();
|
flaggedMessagesText = new List<string>();
|
||||||
|
@ -72,7 +72,7 @@ namespace Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task OnLoadAsync()
|
public async Task OnLoadAsync(IManager manager)
|
||||||
{
|
{
|
||||||
ConfigManager = new ConfigurationManager(typeof(FastRestartPlugin));
|
ConfigManager = new ConfigurationManager(typeof(FastRestartPlugin));
|
||||||
FastRestarts = new Dictionary<int, int>();
|
FastRestarts = new Dictionary<int, int>();
|
||||||
|
@ -33,7 +33,7 @@ namespace MessageBoard.Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task OnLoadAsync()
|
public async Task OnLoadAsync(IManager manager)
|
||||||
{
|
{
|
||||||
ManagerInstance = new Forum.Manager();
|
ManagerInstance = new Forum.Manager();
|
||||||
ManagerInstance.Start();
|
ManagerInstance.Start();
|
||||||
|
@ -189,10 +189,18 @@ namespace StatsPlugin
|
|||||||
get { return "RaidMax"; }
|
get { return "RaidMax"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task OnLoadAsync()
|
public async Task OnLoadAsync(SharedLibrary.Interfaces.IManager manager)
|
||||||
{
|
{
|
||||||
statLists = new List<StatTracking>();
|
statLists = new List<StatTracking>();
|
||||||
ServerStats = new Dictionary<int, ServerStatInfo>();
|
ServerStats = new Dictionary<int, ServerStatInfo>();
|
||||||
|
ManagerInstance = manager;
|
||||||
|
|
||||||
|
WebService.PageList.Add(new StatsPage());
|
||||||
|
WebService.PageList.Add(new KillStatsJSON());
|
||||||
|
|
||||||
|
ManagerInstance.GetMessageTokens().Add(new MessageToken("TOTALKILLS", GetTotalKills));
|
||||||
|
ManagerInstance.GetMessageTokens().Add(new MessageToken("TOTALPLAYTIME", GetTotalPlaytime));
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -219,24 +227,7 @@ namespace StatsPlugin
|
|||||||
{
|
{
|
||||||
if (E.Type == Event.GType.Start)
|
if (E.Type == Event.GType.Start)
|
||||||
{
|
{
|
||||||
if (ManagerInstance == null)
|
|
||||||
{
|
|
||||||
ManagerInstance = S.Manager;
|
|
||||||
lock (WebService.PageList)
|
|
||||||
{
|
|
||||||
WebService.PageList.Add(new StatsPage());
|
|
||||||
WebService.PageList.Add(new KillStatsJSON());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
statLists.Add(new StatTracking(S.GetPort()));
|
statLists.Add(new StatTracking(S.GetPort()));
|
||||||
|
|
||||||
if (statLists.Count == 1)
|
|
||||||
{
|
|
||||||
S.Manager.GetMessageTokens().Add(new MessageToken("TOTALKILLS", GetTotalKills));
|
|
||||||
S.Manager.GetMessageTokens().Add(new MessageToken("TOTALPLAYTIME", GetTotalPlaytime));
|
|
||||||
}
|
|
||||||
|
|
||||||
ServerStats.Add(S.GetPort(), new ServerStatInfo());
|
ServerStats.Add(S.GetPort(), new ServerStatInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,7 +520,7 @@ namespace StatsPlugin
|
|||||||
public List<Stats.KillInfo> GetKillsByMap(Map map, int count)
|
public List<Stats.KillInfo> GetKillsByMap(Map map, int count)
|
||||||
{
|
{
|
||||||
var mapID = ParseEnum<IW4Info.MapName>.Get(map.Name, typeof(IW4Info.MapName));
|
var mapID = ParseEnum<IW4Info.MapName>.Get(map.Name, typeof(IW4Info.MapName));
|
||||||
var queryResult = GetDataTable($"select * from KILLS where MapID == {(int)mapID} LIMIT {count} OFFSET (SELECT COUNT(*) FROM KILLS)-500"); //GetDataTable("KILLS", new KeyValuePair<string, object>("MapID", mapID));
|
var queryResult = GetDataTable($"select * from KILLS where MapID == {(int)mapID} LIMIT {count} OFFSET (SELECT COUNT(*) FROM KILLS) - {count}");
|
||||||
var resultList = new List<Stats.KillInfo>();
|
var resultList = new List<Stats.KillInfo>();
|
||||||
|
|
||||||
if (queryResult?.Rows.Count > 0)
|
if (queryResult?.Rows.Count > 0)
|
||||||
|
@ -55,7 +55,7 @@ namespace StatsPlugin
|
|||||||
ServerMap = s.CurrentMap.Alias,
|
ServerMap = s.CurrentMap.Alias,
|
||||||
ServerInfo = Stats.ServerStats[s.GetPort()],
|
ServerInfo = Stats.ServerStats[s.GetPort()],
|
||||||
Minimap = MinimapConfig.Read(@"Config\minimaps.cfg").MapInfo.Where(m => m.MapName == s.CurrentMap.Name),
|
Minimap = MinimapConfig.Read(@"Config\minimaps.cfg").MapInfo.Where(m => m.MapName == s.CurrentMap.Name),
|
||||||
MapKills = selectCount < 300 ? Stats.ServerStats[s.GetPort()].GetKillQueue().ToArray()
|
MapKills = selectCount < 999 ? Stats.ServerStats[s.GetPort()].GetKillQueue().ToArray()
|
||||||
.Skip(Math.Min(Stats.MAX_KILLEVENTS - selectCount, Stats.ServerStats[s.GetPort()].GetKillQueue().Count - selectCount)) :
|
.Skip(Math.Min(Stats.MAX_KILLEVENTS - selectCount, Stats.ServerStats[s.GetPort()].GetKillQueue().Count - selectCount)) :
|
||||||
Stats.statLists.FirstOrDefault(x => x.Port == s.GetPort()).playerStats.GetKillsByMap(s.CurrentMap, selectCount)
|
Stats.statLists.FirstOrDefault(x => x.Port == s.GetPort()).playerStats.GetKillsByMap(s.CurrentMap, selectCount)
|
||||||
})
|
})
|
||||||
|
@ -43,7 +43,7 @@ namespace IW4MAdmin.Plugins
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task OnLoadAsync()
|
public async Task OnLoadAsync(IManager manager)
|
||||||
{
|
{
|
||||||
Interval = DateTime.Now;
|
Interval = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ namespace Votemap_Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task OnLoadAsync()
|
public async Task OnLoadAsync(IManager manager)
|
||||||
{
|
{
|
||||||
serverVotingList = new List<ServerVoting>();
|
serverVotingList = new List<ServerVoting>();
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ namespace Welcome_Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task OnLoadAsync()
|
public async Task OnLoadAsync(IManager manager)
|
||||||
{
|
{
|
||||||
PlayerPings = new Dictionary<int, float>();
|
PlayerPings = new Dictionary<int, float>();
|
||||||
PingAverageCount = 1;
|
PingAverageCount = 1;
|
||||||
|
@ -5,7 +5,7 @@ namespace SharedLibrary.Interfaces
|
|||||||
{
|
{
|
||||||
public interface IPlugin
|
public interface IPlugin
|
||||||
{
|
{
|
||||||
Task OnLoadAsync();
|
Task OnLoadAsync(IManager manager);
|
||||||
Task OnUnloadAsync();
|
Task OnUnloadAsync();
|
||||||
Task OnEventAsync(Event E, Server S);
|
Task OnEventAsync(Event E, Server S);
|
||||||
Task OnTickAsync(Server S);
|
Task OnTickAsync(Server S);
|
||||||
|
Loading…
Reference in New Issue
Block a user