Skip to content

Commit

Permalink
Add call method to plugins for cross-mod support
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaioru committed Nov 15, 2023
1 parent 8302967 commit 15c7c84
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/common/Edelstein.Common.Plugin/PluginHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public record PluginHost<TContext>(
IConfiguration Config,
string DirectoryHost,
string DirectoryPlugin,
IPluginManager<TContext> Manager,
IPlugin<TContext> Plugin
) : IPluginHost<TContext>
{
Expand Down
1 change: 1 addition & 0 deletions src/common/Edelstein.Common.Plugin/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ await Insert(new PluginHost<TContext>(
configuration,
directoryHost,
directoryPlugin,
this,
plugin
));
}
Expand Down
3 changes: 3 additions & 0 deletions src/protocol/Edelstein.Protocol.Plugin/IPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ public interface IPlugin<TContext> : IIdentifiable<string>
Task OnInit(IPluginHost<TContext> host, TContext ctx);
Task OnStart(IPluginHost<TContext> host, TContext ctx);
Task OnStop();

Task<object?> Call(string type, params object[] args)
=> Task.FromResult<object?>(default);
}
1 change: 1 addition & 0 deletions src/protocol/Edelstein.Protocol.Plugin/IPluginHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ public interface IPluginHost<TContext> : IIdentifiable<string>
string DirectoryHost { get; }
string DirectoryPlugin { get; }

IPluginManager<TContext> Manager { get; }
IPlugin<TContext> Plugin { get; }
}

0 comments on commit 15c7c84

Please sign in to comment.