-
Notifications
You must be signed in to change notification settings - Fork 1
Plugin Development
Alireza Janaki edited this page Nov 28, 2025
·
2 revisions
A plugin is a separate .NET assembly (.dll file) that contains code to extend the server's features. The server automatically loads these assemblies, allowing you to add new functionality without modifying core code.
- .NET 8.0 SDK
- C# IDE (Visual Studio 2022, VS Code, or JetBrains Rider)
- UltimateServer source code
dotnet new classlib -n MyAwesomePlugin
cd MyAwesomePluginAdd the IPlugin interface to your project by copying IPlugin.cs and PluginContext.cs from the server project.
Create MainPlugin.cs:
using System.Threading.Tasks;
using UltimateServer.Plugins;
namespace MyAwesomePlugin
{
public class MainPlugin : IPlugin
{
public string Name => "My Awesome Plugin";
public string Version => "1.0.0";
public async Task OnLoadAsync(PluginContext context)
{
context.Logger.Log("Hello from My Awesome Plugin! I have been loaded.");
await Task.CompletedTask;
}
public async Task OnUpdateAsync(PluginContext context)
{
context.Logger.Log("My Awesome Plugin has been updated.");
await Task.CompletedTask;
}
public async Task OnUnloadAsync(PluginContext context)
{
context.Logger.Log("Goodbye! My Awesome Plugin is unloading.");
await Task.CompletedTask;
}
}
}
dotnet build -c Release- Navigate to your UltimateServer root directory
- Create a
pluginsfolder if it doesn't exist - Copy
MyAwesomePlugin.dllto thepluginsfolder
Start the server:
dotnet Server.dll 11001 11002 11003You should see output like:
π Scanning for plugins in '.../UltimateServer/plugins'
π Found valid assembly: MyAwesomePlugin, Version=1.0.0.0
β
Loaded plugin: My Awesome Plugin v1.0.0
Hello from My Awesome Plugin! I have been loaded.
π Plugin loading complete. 1 plugins loaded.public async Task OnLoadAsync(PluginContext context)
{
// Access logger
context.Logger.Log("Plugin loaded!");
// Access configuration
var authSystem = context.ServiceProvider.GetRequiredService<AuthenticationService>();;
// Register custom commands or events
await Task.CompletedTask;
}
Update your plugin code, rebuild, and copy the new DLL to the plugins folder. The server will automatically reload it without restarting.
- Use meaningful plugin names and versions
- Handle exceptions properly in lifecycle methods
- Clean up resources in
OnUnloadAsync - Test plugins thoroughly before deployment