add plugins loaded event (#830)

This commit is contained in:
Daniel Liland 2025-08-07 10:48:40 +02:00 committed by GitHub
parent 3298c7b6d5
commit 3648989f26
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View File

@ -126,4 +126,13 @@ namespace MCGalaxy.Events.ServerEvents
CallCommon(pl => pl(p, channel, data));
}
}
public delegate void OnPluginsLoaded();
/// <summary>Called when all plugins have been auto-loaded.</summary>
public sealed class OnPluginsLoadedEvent : IEvent<OnPluginsLoaded> {
public static void Call() {
if (handlers.Count == 0) return;
CallCommon(pl => pl());
}
}
}

View File

@ -19,6 +19,7 @@ using System;
using System.Collections.Generic;
using System.Net;
using MCGalaxy.DB;
using MCGalaxy.Events.ServerEvents;
using MCGalaxy.Generator;
using MCGalaxy.Network;
using MCGalaxy.Tasks;
@ -46,7 +47,11 @@ namespace MCGalaxy
LevelInfo.Add(mainLevel);
}
static void LoadAllPlugins(SchedulerTask task) { Plugin.LoadAll(); }
static void LoadAllPlugins(SchedulerTask task)
{
Plugin.LoadAll();
OnPluginsLoadedEvent.Call();
}
static void InitPlayerLists(SchedulerTask task) {
try {